Table of Contents

Name

qthread_lock, qthread_unlock - lock or unlock an address

Synopsis

#include <qthread.h>

int
qthread_lock (aligned_t *addr);

int
qthread_unlock (aligned_t *addr);

Description

These functions are designed to implement FEB-like locking and unlocking that behaves much more like a mutex.

These are atomic and functional, but do not have the same semantics as full FEB locking/unlocking (namely, unlocking cannot block), however because of this, they have lower overhead.

Return Value

On success, the memory address addr is marked locked or unlocked appropriately and 0 is returned. If unlocking an address that is already unlocked, QTHREAD_REDUNDANT will be 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_readFE(3)


Table of Contents