Zeljko Vrba wrote:
On Mon, Mar 17, 2008 at 04:09:53PM +0100, Hughes, James wrote:
Or put a usleep(0) in the thread to force the timeslice to expire? IIRC.
Calling sched_yield() would also probably help, but that's a non-solution to the OP's non-problem. To the OP: if a particular order of execution is desired, it has to be explicitly coded with various synchronization primitives.
It's not about order of execution. I explained it in another post, but it didn't come through right away due to moderation. (Are all posts directly to the news group moderated? Do I have to post via email for more timely posting?) My concern, when I saw one thread execute completely then another is that it seems one thread hogs the resources, even if it's not doing heavy work. Since my main task, in the actual program I'm writing, is to monitor something and report all output on one thread and to have another to allow commands to go to the device, I want to be sure that the monitoring thread won't be blocked while data it needs is coming in, but I don't want that thread to block the other one while it (the monitoring thread) is waiting for incoming data. Hal