cp_heap_lock(3)

cp_heap(3) libcprops - cp_heap cp_heap(3)

NAME

cp_heap_lock, cp_heap_unlock - lock / unlock a heap for transaction like access

SYNOPSIS

#include <cprops/heap.h>

int cp_heap_lock(cp_heap *heap, int type);
int cp_heap_unlock(cp_heap *heap);

DESCRIPTION

Unless the mode bit COLLECTION_MODE_NOSYNC is set, heap operation are synchronized, i.e. prevent simultaneous access from multiple threads. cp_heap_lock is needed to perform a transaction-like operation consisting multiple heap operations that must complete before other threads are allowed access. cp_heap_lock locks the heap so that only the current thread can perform heap operations, and cp_heap_unlock releases the lock.

RETURN VALUE

cp_heap_lock and cp_heap_unlock return 0 on success or non-zero on failure.

SEE ALSO

JULY 2006 libcprops.0.1.5