Table of Contents

Name

qthread_readFE - waits for the source to be full, then copies it

Synopsis

#include <qthread/qthread.h>

int
qthread_readFE(qthread_t *me, aligned_t *dest, const aligned_t *src);

Description

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 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"

This function takes a qthread_t pointer as an argument (me), which is supposed to point to the qthread_t relating to the currently executing qthread. If me is NULL, the current qthread will be discovered using qthread_self().

Warning

This, and all other FEB-related functions currently operate exclusively on aligned data. This is to simulate the behavior of the MTA as closely as possible. The library requires 4-byte alignment.

Return Value

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

Errors

ENOMEM
Not enough memory could be allocated for bookkeeping structures.

See Also

qthread_empty(3) , qthread_fill(3) , qthread_writeEF(3) , qthread_writeF(3) , qthread_readFF(3) , qthread_lock(3) , qthread_unlock(3)


Table of Contents