Page 1 of 1

discrepancy in guide on how to wake up a thread

Posted: Thu Dec 13, 2012 8:43 am
by hazelnusse
In http://www.chibios.org/dokuwiki/doku.php?id=chibios:howtos:wakeup it has:

Code: Select all

/* Waiting for the IRQ to happen.*/
    chSysLock();
    tp = chThdSelf();
    chSchGoSleepS(THD_STATE_SUSPENDED);
    msg = chThdSelf()->p_u.rdymsg;  /* Retrieving the message, optional.*/
    chSysUnlock();

In the API docs for chThdSelf() it says:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.


Is the API doc incorrect, or is the guide incorrect?

Re: discrepancy in guide on how to wake up a thread

Posted: Thu Dec 13, 2012 9:03 am
by Giovanni
Hi,

Thanks for finding, it is a documentation error, that function can be called in any context (the state checker does not complain about it so it is OK).

Giovanni

Re: discrepancy in guide on how to wake up a thread

Posted: Thu Dec 13, 2012 12:27 pm
by hazelnusse
No problem, glad I could help.