diff options
author | David Phillips <david@sighup.nz> | 2018-08-28 15:28:49 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-08-28 15:28:49 +1200 |
commit | e196fa9f981da1eee2313f6817318397ea74f5d5 (patch) | |
tree | 0f78c90342b08d596043294afc64fe51764124f8 /alarmd/alarmd_lock.c | |
parent | 8edfe990e819dcc1a951e9bf73c338a015cb6a6a (diff) | |
download | alarmd-e196fa9f981da1eee2313f6817318397ea74f5d5.tar.xz |
Handle clients in separate threads, add mutexes
Diffstat (limited to 'alarmd/alarmd_lock.c')
-rw-r--r-- | alarmd/alarmd_lock.c | 21 |
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); +} |