From 3780fa47407ffd08e6bd46c01384d25359708107 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Sun, 30 Aug 1998 18:58:06 +0000
Subject: [PATCH] rdwr.h from orielly examples (with multiple inclusion
 protection)

---
 include/lthread_rdwr.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 include/lthread_rdwr.h

diff --git a/include/lthread_rdwr.h b/include/lthread_rdwr.h
new file mode 100644
index 0000000000..d5335d792f
--- /dev/null
+++ b/include/lthread_rdwr.h
@@ -0,0 +1,34 @@
+#ifndef _LTHREAD_RDWR_H
+#define _LTHREAD_RDWR_H 1
+
+/********************************************************
+ * An example source module to accompany...
+ *
+ * "Using POSIX Threads: Programming with Pthreads"
+ *     by Brad nichols, Dick Buttlar, Jackie Farrell
+ *     O'Reilly & Associates, Inc.
+ *
+ ********************************************************
+ * 
+ * Include file for reader/writer locks
+ * 
+ */
+
+typedef struct rdwr_var {
+	int readers_reading;
+	int writer_writing;
+	pthread_mutex_t mutex;
+	pthread_cond_t lock_free;
+} pthread_rdwr_t;
+
+typedef void * pthread_rdwrattr_t;
+
+#define pthread_rdwrattr_default NULL;
+
+int pthread_rdwr_init_np(pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp);
+int pthread_rdwr_rlock_np(pthread_rdwr_t *rdwrp);
+int pthread_rdwr_runlock_np(pthread_rdwr_t *rdwrp);
+int pthread_rdwr_wlock_np(pthread_rdwr_t *rdwrp);
+int pthread_rdwr_wunlock_np(pthread_rdwr_t *rdwrp);
+
+#endif /* _LTHREAD_RDWR_H */
-- 
GitLab