Cygdrvcondwait, Cygdrvcondsignal, Cyg_drv_cond_signal – Comtrol eCos User Manual

Page 402: Cyg_drv_cond_broadcast, Cyg_drv_cond_wait

Advertising
background image

Chapter 18. Device Driver Interface to the Kernel

cyg_drv_cond_wait

Function:

void cyg_drv_cond_wait( cyg_drv_cond *cond )

Arguments:

cond

- condition variable to wait on

Result:

None

Level:

Thread

Description:

Wait for a signal on the condition variable pointed to by the

cond

argument. The thread must have locked

the associated mutex, supplied in

cyg_drv_cond_init()

, before waiting on this condition variable. While

the thread waits, the mutex will be unlocked, and will be re-locked before this function returns. It is
possible for threads waiting on a condition variable to occasionally wake up spuriously. For this reason it
is necessary to use this function in a loop that re-tests the condition each time it returns. Note that this
function performs an implicit scheduler unlock/relock sequence, so that it may be used within an explicit

cyg_drv_dsr_lock()...cyg_drv_dsr_unlock()

structure.

cyg_drv_cond_signal

Function:

void cyg_drv_cond_signal( cyg_drv_cond *cond )

Arguments:

cond

- condition variable to signal

Result:

None

Level:

DSR

Description:

Signal the condition variable pointed to by the

cond

argument. If there are any threads waiting on this variable

at least one of them will be awakened. Note that in some configurations there may not be any difference
between this function and

cyg_drv_cond_broadcast()

.

298

Advertising