summaryrefslogtreecommitdiffstats
path: root/src/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/map.c b/src/map.c
index 4b936c2..bdde29c 100644
--- a/src/map.c
+++ b/src/map.c
@@ -24,7 +24,6 @@
#endif
#include <sys/types.h>
-#include <pthread.h>
#include <search.h>
#include <stdlib.h>
#include <string.h>
@@ -45,6 +44,7 @@
#include "dispatch.h"
#include "map.h"
#include "portmap.h"
+#include "wrap.h"
/* The singleton for the cache. */
struct {
@@ -80,6 +80,7 @@ struct {
int n_maps;
} *domains;
int n_domains;
+ struct wrapped_rwlock *lock;
} map_data;
static void *
@@ -813,6 +814,28 @@ int
map_init(struct slapi_pblock *pb, struct plugin_state *state)
{
memset(&map_data, 0, sizeof(map_data));
+ map_data.lock = wrap_new_rwlock();
+ if (map_data.lock == NULL) {
+ return -1;
+ }
backend_init(pb, state);
return 0;
}
+
+void
+map_rdlock(void)
+{
+ wrap_rwlock_rdlock(map_data.lock);
+}
+
+void
+map_wrlock(void)
+{
+ wrap_rwlock_wrlock(map_data.lock);
+}
+
+void
+map_unlock(void)
+{
+ wrap_rwlock_unlock(map_data.lock);
+}