OSDN Git Service

Add missing mutex lock/unlock inside alarm_cleanup()
authorPavlin Radoslavov <pavlin@google.com>
Wed, 20 Apr 2016 02:16:26 +0000 (19:16 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 22 Apr 2016 22:55:39 +0000 (15:55 -0700)
Bug: 26982349
Change-Id: I32f4e6450491adcc1e12e71fb8bb582d6397a91a

osi/src/alarm.c

index 2a115e6..d070678 100644 (file)
@@ -292,6 +292,8 @@ void alarm_cleanup(void) {
   if (!alarms)
     return;
 
+  pthread_mutex_lock(&monitor);
+
   dispatcher_thread_active = false;
   semaphore_post(alarm_expired);
   thread_free(dispatcher_thread);
@@ -308,6 +310,7 @@ void alarm_cleanup(void) {
   list_free(alarms);
   alarms = NULL;
 
+  pthread_mutex_unlock(&monitor);
   pthread_mutex_destroy(&monitor);
 }