2 * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
5 * Redistribution and use in source and binary forms are permitted only
6 * as authorized by the OpenLDAP Public License. A copy of this
7 * license is available at http://www.OpenLDAP.org/license.html or
8 * in file LICENSE in the top-level directory of the distribution.
11 #ifndef _LTHREAD_RDWR_H
12 #define _LTHREAD_RDWR_H 1
14 /********************************************************
15 * An example source module to accompany...
17 * "Using POSIX Threads: Programming with Pthreads"
18 * by Brad nichols, Dick Buttlar, Jackie Farrell
19 * O'Reilly & Associates, Inc.
21 ********************************************************
23 * Include file for reader/writer locks
27 #include <ldap_cdefs.h>
31 typedef struct rdwr_var {
34 pthread_mutex_t mutex;
35 pthread_cond_t lock_free;
38 typedef void * pthread_rdwrattr_t;
40 #define pthread_rdwrattr_default NULL;
42 LDAP_F int pthread_rdwr_init_np LDAP_P((pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp));
43 LDAP_F int pthread_rdwr_rlock_np LDAP_P((pthread_rdwr_t *rdwrp));
44 LDAP_F int pthread_rdwr_runlock_np LDAP_P((pthread_rdwr_t *rdwrp));
45 LDAP_F int pthread_rdwr_wlock_np LDAP_P((pthread_rdwr_t *rdwrp));
46 LDAP_F int pthread_rdwr_wunlock_np LDAP_P((pthread_rdwr_t *rdwrp));
49 LDAP_F int pthread_rdwr_rchk_np LDAP_P((pthread_rdwr_t *rdwrp));
50 LDAP_F int pthread_rdwr_wchk_np LDAP_P((pthread_rdwr_t *rdwrp));
51 LDAP_F int pthread_rdwr_rwchk_np LDAP_P((pthread_rdwr_t *rdwrp));
52 #endif /* LDAP_DEBUG */
56 #endif /* _LTHREAD_RDWR_H */