cp_hashlist

Section: libcprops - cp_hashlist (3)
Updated: OCTOBER 2005
Index Return to Main Contents
 

NAME

cp_hashlist_lock, cp_hashlist_unlock, cp_hashlist_rd_lock, cp_hashlist_wrlock - hashlist locking functions  

SYNOPSIS

#include <cprops/hashlist.h>

int cp_hashlist_lock(cp_hashlist *list, int type);
int cp_hashlist_unlock(cp_hashlist *list);
int cp_hashlist_rdlock(cp_hashlist *list);
int cp_hashlist_wrlock(cp_hashlist *list);  

DESCRIPTION

cp_hashlist_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 list operations are synchronized and do not require explicit locking. Explicit locking is required for transaction-like operations where several list operations must complete as a group before allowing other threads to access the list. Once a thread has obtained the list lock, subsequent list 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 list content, the list must be locked for writing; Otherwise it may be locked for reading.

cp_hashlist_unlock releases a lock previously acquired with cp_hashlist_lock. cp_hashlist_rdlock and cp_hashlist_wrlock are the same as calling cp_hashlist_lock with COLLECTION_LOCK_READ and COLLECTION_LOCK_WRITE respectively.  

RETURN VALUE

locking functions return 0 on success or a non-zero error code on failure.  

ERRORS

EINVAL
the list was instantiated with COLLECTION_MODE_NOSYNC or an invalid lock type code was given.
Other error codes may be returned from the underlying synchronization api.
 

SEE ALSO

pthread_rwlock_rdlock(3), pthread_rwlock_wrlock(3), cp_hashlist(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 12:01:45 GMT, May 23, 2006
SourceForge.net Logo