From c7b3ab9553dea50ae7151d9847c1b62a0213f275 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 23 Nov 2016 11:22:54 +0100 Subject: Fix mu-threads build on linux. --- source/helpers/mu-threads/mu-threads.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/helpers/mu-threads/mu-threads.c b/source/helpers/mu-threads/mu-threads.c index bbc87d1a..847c3368 100644 --- a/source/helpers/mu-threads/mu-threads.c +++ b/source/helpers/mu-threads/mu-threads.c @@ -245,7 +245,7 @@ int mu_create_thread(mu_thread *th, mu_thread_fn *fn, void *arg) void mu_destroy_thread(mu_thread *th) { - const static mu_thread empty = { 0 }; + const static mu_thread empty; /* static objects are always initialized to zero */ if (memcmp(th, &empty, sizeof(empty)) == 0) return; @@ -261,9 +261,11 @@ int mu_create_mutex(mu_mutex *mutex) void mu_destroy_mutex(mu_mutex *mutex) { - const static mu_mutex empty = { 0 }; + const static mu_mutex empty; /* static objects are always initialized to zero */ + if (memcmp(mutex, &empty, sizeof(empty)) == 0) return; + (void)pthread_mutex_destroy(&mutex->mutex); *mutex = empty; } -- cgit v1.2.3