我認為每次生產(chǎn)者與消費者模型,完成一次生產(chǎn)與消費大約需要20毫秒時間。 而不是1-2毫秒甚至忽略不計。作者: JohnBull 時間: 2011-04-21 17:59
不要以為用了RR效果就會好,很可能適得其反,因為引入了不必要的上下文切換。作者: zhutroy 時間: 2011-04-21 18:54 回復 10#JohnBull
There are two threads
thread1 always call ioctl one time every second.
thread2 always call two steps ioctl one time every second.
thread2 require two step must not be interrupted by thread1's ioctl
The operations as the following is not permitted.
ioctl //thread2
ioctl //thread1 interrupted
ioctl //thread2
I want to use pthread_mutex, semaphore, cond_wait .... but because thread1 is a lib.and it can't not be changed.
So how can I protect two steps ioctl, guarantee it will not be interrupted by thread1?
Thanks very much.