miniplayer
play_thread decode thread
(usr1)>> fill mem1
<<(usr1)prepared
loop:
play mem1
at starting(usr2)>>
fill mem2
play mem2
at starting(usr1)>>
fill mem1
go to loop
<<(usr2)finished
break loop
|
但是以上的实现时有问题的,因为共享内存的线程的信号处理机制比较复杂,一般是不能同时在两个线程中处理同一个信号的;而如果使用进程而不是线程,就需要设置共享内存。
暂时考虑使用线程和信号机制。更改如下:
play_thread decode thread (usr1)>> fill <<(usr2)prepared loop: play mem1 at starting(usr1)>> fill play mem2 at starting(usr1)>> fill go to loop <<(usr2)finished break loop
fill: init: flag = 0; contex: if(flag = ~flag) fill mem1
else
fill mem2
end if the same goes with USR2 |
阅读(1102) | 评论(0) | 转发(0) |