Table of Contents


qthread_syncvar_readFE - waits for the syncvar to be full, then copies its data and empties it


#include <qthread.h>

qthread_syncvar_readFE (uint64_t * restrict dest, syncvar_t * restrict src);


This function waits for memory to become full, and then empties it. When memory becomes full, only one thread blocked like this will be awoken. Data is read from src and stored in dest. The dest may be NULL, in which case the data will not be copied.

The semantics of readFE are:

1 - src’s FEB state must be "full"
2 - data is copied from src to dest
3 - src’s FEB state gets changed from "full" to "empty"

Return Value

On success, the memory address src is marked empty, the memory address dest is filled with the contents of src and 0 (QTHREAD_SUCCESS) is returned. On error, a non-zero error code is returned.


Not enough memory could be allocated for bookkeeping structures. QTHREAD_TIMEOUT Could not obtain the lock on the syncvar_t’s status bits. This may be caused by many things, including memory corruption, invalid syncvar, or even absurdly excessive contention (because its protected by a naive spinlock rather than a fair spinlock).

See Also

qthread_syncvar_empty(3) , qthread_syncvar_fill(3) , qthread_syncvar_writeFE(3) , qthread_syncvar_writeF(3) , qthread_syncvar_readFF(3) , qthread_syncvar_status(3)

Table of Contents