]> git.sur5r.net Git - openldap/commitdiff
more ldap_cdefs.h, less bridge.h
authorKurt Zeilenga <kurt@openldap.org>
Wed, 23 Sep 1998 08:56:54 +0000 (08:56 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 23 Sep 1998 08:56:54 +0000 (08:56 +0000)
include/ldif.h
include/lthread.h
include/lthread_rdwr.h [new file with mode: 0644]
libraries/liblthread/thread.c

index dd2b339193ec723426f90939b17008dd723ae97c..c24bb0a1526e9b44a2a6857ebf4650e5205abd1d 100644 (file)
@@ -13,9 +13,9 @@
 #ifndef _LDIF_H
 #define _LDIF_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
 
 #define LINE_WIDTH      76      /* maximum length of LDIF lines */
 
@@ -34,23 +34,14 @@ extern "C" {
  */
 #define LDIF_SIZE_NEEDED(tlen,vlen) \
     ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
-    + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LINE_WIDTH * 2 ))
-
-
-#ifdef NEEDPROTOS
-int str_parse_line( char *line, char **type, char **value, int *vlen);
-char * str_getline( char **next );
-void put_type_and_value( char **out, char *t, char *val, int vlen );
-char *ldif_type_and_value( char *type, char *val, int vlen );
-#else /* NEEDPROTOS */
-int str_parse_line();
-char * str_getline();
-void put_type_and_value();
-char *ldif_type_and_value();
-#endif /* NEEDPROTOS */
-
-#ifdef __cplusplus
-}
-#endif
+    + ((LDIF_BASE64_LEN(vlen) + (tlen) + 3) / LINE_WIDTH * 2 ))
+
+
+int str_parse_line LDAP_P(( char *line, char **type, char **value, int *vlen));
+char * str_getline LDAP_P(( char **next ));
+void put_type_and_value LDAP_P(( char **out, char *t, char *val, int vlen ));
+char *ldif_type_and_value LDAP_P(( char *type, char *val, int vlen ));
+
+LDAP_END_DECL
 
 #endif /* _LDIF_H */
index d3fd3d0ec65b3ecb1a84b612eb3f8cbe2db03dc7..e9a4ee4f4609d1973e9ae08cc25200d86971b179 100644 (file)
@@ -3,6 +3,10 @@
 #ifndef _LTHREAD_H
 #define _LTHREAD_H
 
+#include <portable.h>
+
+LDAP_BEGIN_DECL
+
 #if defined ( THREAD_NEXT_CTHREADS )
 
 #define _THREAD
@@ -222,4 +226,7 @@ typedef int     pthread_condattr_t;
 typedef int    pthread_cond_t;
 
 #endif /* no threads support */
+
+LDAP_END_DECL
+
 #endif /* _LTHREAD_H */
diff --git a/include/lthread_rdwr.h b/include/lthread_rdwr.h
new file mode 100644 (file)
index 0000000..1c751f3
--- /dev/null
@@ -0,0 +1,46 @@
+#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
+ * 
+ */
+
+#include <ldap_cdefs.h>
+
+LDAP_BEGIN_DECL
+
+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 LDAP_P((pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp));
+int pthread_rdwr_rlock_np LDAP_P((pthread_rdwr_t *rdwrp));
+int pthread_rdwr_runlock_np LDAP_P((pthread_rdwr_t *rdwrp));
+int pthread_rdwr_wlock_np LDAP_P((pthread_rdwr_t *rdwrp));
+int pthread_rdwr_wunlock_np LDAP_P((pthread_rdwr_t *rdwrp));
+
+#ifdef LDAP_DEBUG
+int pthread_rdwr_rchk_np LDAP_P((pthread_rdwr_t *rdwrp));
+int pthread_rdwr_wchk_np LDAP_P((pthread_rdwr_t *rdwrp));
+int pthread_rdwr_rwchk_np LDAP_P((pthread_rdwr_t *rdwrp));
+#endif /* LDAP_DEBUG */
+
+LDAP_END_DECL
+
+#endif /* _LTHREAD_RDWR_H */
index d0a62d5a815e0c8ae15a51edc13eb9d82f81fb32..d4fea7e477e640f12aab3b173b82fb1c1f666ab8 100644 (file)
@@ -1,6 +1,9 @@
 /* thread.c - glue routines to provide a consistent thread interface */
-#include <stdio.h>
-#include "lthread.h"
+
+#define DISABLE_BRIDGE
+#include "portable.h"
+
+#include <lthread.h>
 
 #if defined( THREAD_NEXT_CTHREADS )