AW: [En-Nut-Discussion] Again a thread question

Pavel Chromy chromy at asix.cz
Wed Jun 9 15:20:22 CEST 2004



Ole Reinhardt wrote:

>>I'm still not getting why you need/want the lcd thread be running with lower priority, while you do the scheduling yourself (waiting one second)? I see no reason for that. 
> 
> 
> You'r right. In this case I don't need it. It was just a test. I think I
> now understood what's the difference between preemotive and cooperative
> multithreading.
> 
> But if I like to rise the granularity of the context switches I still
> would like to "NutThreadYield" to give other thread the possibility to
> run. If I understood this command makes only sense if called from within
> a lower or same priority thread. You can't give cpu time to a thread
> with lower priority?

That's right, you can't at least this way, just keep in mind this logic: threads with lower priority are allowed to run only if all threads with higher priority are waiting for an event. Everything else is pretty clear then.
NutThreadYield() performes a context switch and the thread to be run is chosen from all threads which are ready to run,
with the higher priority threads first, but it keeps the current thread ready to run - that is pretty logical, there is no event the thread should be waiting for.

-- 
#define QUESTION ((bb)||!(bb))

Mgr. Pavel Chromy
ASIX s.r.o.
Staropramenna 4
150 00 Praha 5



More information about the En-Nut-Discussion mailing list