[En-Nut-Discussion] THREAD's

Harald Kipp harald.kipp at egnite.de
Wed Sep 1 20:28:32 CEST 2004


Daniel,

this "bug" (or wrong API doc) had been detected and fixed lately
by Matthias Ringwald.
http://cvs.sourceforge.net/viewcvs.py/ethernut/nut/os/event.c?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h

Harald


At 20:12 01.09.2004 +0200, you wrote:
>Hello,
>
>we wanted to test the switching time of the threads, there are 2 threads 
>to run.
>The first one set's the output bit and the second one have to clear the 
>same bit.
>The Problem is: Only the first created thread will run and the second not. 
>Both threads have the same priority.
>
>What is wrong ?
>
>Here is the code:
>
>...
>
>THREAD(Thread1, arg)
>{
>NutThreadSetPriority(16);
>    while(1)
>    {
>        sbi(PORTB,0);
>        NutThreadYield();
>
>    }
>}
>THREAD(Thread2, arg)
>{
>NutThreadSetPriority(16);
>
>     while(1)
>    {
>        cbi(PORTB,0);
>        NutThreadYield();
>    }
>
>}
>
>int main(void)
>{
>...
>//create worker threads
>NutThreadCreate("worker1", Thread1, 0, 192);
>NutThreadCreate("worker2", Thread2, 0, 192);
>for (;;)
>{
>    NutSleep(65000);
>}
>}
>
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion




More information about the En-Nut-Discussion mailing list