Table of Contents
qthread_writeEF, qthread_writeEF_const - waits for the dest to be empty,
then fills it
#include <qthread/qthread.h>
int
qthread_writeEF(qthread_t *me, aligned_t *dest, const aligned_t *src);
int
qthread_writeEF_const(qthread_t *me, aligned_t *dest, const aligned_t src);
These functions wait for memory to become empty, and then fill
it. When memory becomes empty, only one thread blocked like this will be
awoken. Data is read from src and written to dest.
The semantics of writeEF
are:
1 - dest’s FEB state must be "empty"
2 - data is copied from src to dest
3 - dest’s FEB state gets changed from "empty" to "full"
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().
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.
If the library was compiled for a 32-bit architecture, it will require 4-byte
alignment and reads/writes will operate on four bytes at a time; if the
library was compiled for a 64-bit architecture, it will require 8-byte alignment
and reads/writes will operate on eight bytes at a time.
On success,
the memory address dest is marked full, the address dest is filled with
the contents of src and 0 is returned. On error, a non-zero error code is
returned.
- ENOMEM
- Not enough memory could be allocated for bookkeeping
structures.
qthread_empty(3)
, qthread_fill(3)
, qthread_writeF(3)
,
qthread_readFF(3)
, qthread_readFE(3)
, qthread_lock(3)
, qthread_unlock(3)
Table of Contents