[En-Nut-Discussion] Problems when creating multiple threads of the same type

Ole Reinhardt ole.reinhardt at kernelconcepts.de
Thu Jul 1 18:24:53 CEST 2004


Hi all,

I have a strange behavior I can't explain. I have some code that calls:

for (count=0; count < devicecount; count++)
{
    sprintf(threadname, "MCAN-%d", count);
    NutThreadCreate(threadname, MCAN_SM, (void*)count, 2048);
}

So the same thread is started a couple of times, always with different
thread names. The threads mainloop looks like:

    for (;;)
    {
        NutEventWait(devices[devnr].waitqueue, NUT_WAIT_INFINITE);
        fprintf(uart, "ID: %d, Got an answer..." NL, did);
    }

When I start the treads the initialisation code of each thread is
executed fine. In another thread "NutEventPost(devices[devnr].waitqueue"
is called on reception of some data from uart. At the same time my whole
program crashes...

What does happen? Does NutEventWait / NutEventPost does not work
properly if called from the same pice of code multiple times? Is the
code reentrant? (It's always called with different waitqueues.

Does the waitqueues have to be initialized with a special value?

Regards,

Ole

-- 
kernel concepts    Tel: +49-271-771091-14
Dreisbachstr. 24   Fax: +49-271-771091-19
D-57250 Netphen    E+ : +49-177-7420433
--





More information about the En-Nut-Discussion mailing list