aboutsummaryrefslogtreecommitdiff
path: root/alarmd/alarmd_lock.c
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-08-28 15:28:49 +1200
committerDavid Phillips <david@sighup.nz>2018-08-28 15:28:49 +1200
commite196fa9f981da1eee2313f6817318397ea74f5d5 (patch)
tree0f78c90342b08d596043294afc64fe51764124f8 /alarmd/alarmd_lock.c
parent8edfe990e819dcc1a951e9bf73c338a015cb6a6a (diff)
downloadalarmd-e196fa9f981da1eee2313f6817318397ea74f5d5.tar.xz
Handle clients in separate threads, add mutexes
Diffstat (limited to 'alarmd/alarmd_lock.c')
-rw-r--r--alarmd/alarmd_lock.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/alarmd/alarmd_lock.c b/alarmd/alarmd_lock.c
new file mode 100644
index 0000000..9770183
--- /dev/null
+++ b/alarmd/alarmd_lock.c
@@ -0,0 +1,21 @@
+#include <pthread.h>
+
+static pthread_mutex_t alarmd_global_lock = PTHREAD_MUTEX_INITIALIZER;
+
+
+int alarmd_lock_destroy()
+{
+ return pthread_mutex_destroy(&alarmd_global_lock);
+}
+
+
+int alarmd_lock()
+{
+ return pthread_mutex_lock(&alarmd_global_lock);
+}
+
+
+int alarmd_unlock()
+{
+ return pthread_mutex_unlock(&alarmd_global_lock);
+}