Section: libcprops - cp_hashtable (3)
Updated: OCTOBER 2005
Return to Main Contents
cp_hashtable_rd_lock, cp_hashtable_wrlock - hashtable locking functions
int cp_hashtable_lock(cp_hashtable *table, int type);
int cp_hashtable_unlock(cp_hashtable *table);
int cp_hashtable_rdlock(cp_hashtable *table);
int cp_hashtable_wrlock(cp_hashtable *table);
cp_hashtable_lock attempts a lock of the type given in type.
Possible lock types are COLLECTION_LOCK_READ, which allows other threads
to read concurrently, COLLECTION_LOCK_WRITE, which grants exclusive
access or COLLECTION_LOCK_NONE which has no effect. Unless
COLLECTION_MODE_NOSYNC is set, single table operations are synchronized and do
not require explicit locking. Explicit locking is required for transaction-like
operations where several table operations must complete as a group before
allowing other threads to access the table. Once a thread has obtained the
table lock, subsequent table operations on this thread will not attempt to
perform additional locking, but will attempt locking on other threads. The
application is responsible for performing the correct type of locking - if any
changes may be made to table content, the table must be locked for writing;
Otherwise it may be locked for reading.
releases a lock previously acquired with cp_hashtable_lock.
are the same as calling
locking functions return 0 on success or a non-zero error code on failure.
was instantiated with
or an invalid lock type code was given.
Other error codes may be returned from the underlying synchronization api.
- RETURN VALUE
- SEE ALSO
This document was created by
using the manual pages.
Time: 12:01:45 GMT, May 23, 2006