summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
authormannol <eniz_vukovic@hotmail.com>2014-11-29 13:42:19 +0100
committermannol <eniz_vukovic@hotmail.com>2014-11-29 13:42:19 +0100
commite62ded3a6dfc1203418e3d7a2c936794c4c9ec1c (patch)
tree74db9ab7f52295304e6079d8e90b8d5b5f3afc67 /toxcore/util.c
parent975ce25af0e469f3b2d80478695d3bbe8e79be79 (diff)
More av cleanup
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 3d444b07..d7ae016f 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -162,3 +162,22 @@ int load_state(load_state_callback_func load_state_callback, void *outer,
162 162
163 return length == 0 ? 0 : -1; 163 return length == 0 ? 0 : -1;
164}; 164};
165
166int create_recursive_mutex(pthread_mutex_t* mutex)
167{
168 pthread_mutexattr_t attr;
169
170 if (pthread_mutexattr_init(&attr) != 0)
171 return -1;
172
173 if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
174 return -1;
175
176 /* Create queue mutex */
177 if (pthread_mutex_init(mutex, &attr) != 0)
178 return -1;
179
180 pthread_mutexattr_destroy(&attr);
181
182 return 0;
183}