chThdCreateStatic hangs Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
Al B
Posts: 24
Joined: Thu Jun 09, 2016 4:01 am
Been thanked: 2 times

chThdCreateStatic hangs

Post by Al B »

Hi,

In testing LwIP, had an issue with chThdCreateStatic hanging, if CH_CFG_NO_IDLE_THREAD = TRUE.

In the lwip_bindings/lwipthread.c lwipInit code:
/* Creating the lwIP thread (it changes priority internally).*/
chThdCreateStatic(wa_lwip_thread, sizeof (wa_lwip_thread),
chThdGetPriorityX() - 1, lwip_thread, (void *)opts);

this causes chSchReadyI to hang since it can't insert the thread (line 231).

Easy enough to work around, by creating an IDLE thread, or by changing priority of the lwip thread, but maybe some other checks/protection should also be provided in the OS?

Thanks,
Al
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: chThdCreateStatic hangs

Post by Giovanni »

Hi,

When that option is set to TRUE the main() function is your idle thread, you must not sleep in there. This option is there for compatibility with NIL or if you want to save one thread when you have nothing to do in main().

About the lwIP thread, probably there should be an assertion there, it cannot work with this option enabled. You may initialize lwIP from another thread as workaround.

Giovanni
Post Reply