Table of Contents

Name

qthread_writeEF, qthread_writeEF_const - waits for the dest to be empty, then fills it

Synopsis

#include <qthread.h>

int
qthread_writeEF (aligned_t * restrict dest, const aligned_t * restrict src);

int
qthread_writeEF_const (aligned_t *dest, aligned_t src);

Description

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"

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

Return Value

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.

Errors

ENOMEM
Not enough memory could be allocated for bookkeeping structures.

See Also

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


Table of Contents