CoverityFix-CID:1367361 Wait without held lock 90/19990/3
Nimish Kapoor [Tue, 1 May 2018 06:33:42 +0000 (11:33 +0530)]
Change-Id: I56db0183120ac2604ddfa10ba6f75fade17006b2

scilab/modules/core/src/c/signal_mgmt.c

index b948e4c..71a50df 100644 (file)
@@ -518,6 +518,7 @@ static void* watchdog_thread(void* arg)
     memset(&abstime, 0, sizeof(struct timespec));
     abstime.tv_sec = tv.tv_sec + timeoutDelay;
 
+    pthread_mutex_lock(&watchdog_mutex);
     while (1)
     {
         if (pthread_cond_timedwait(&dummy_condition, &watchdog_mutex, &abstime) == ETIMEDOUT)
@@ -529,6 +530,7 @@ static void* watchdog_thread(void* arg)
             kill(getpid(), SIGABRT);
         }
     }
+    pthread_mutex_unlock(&watchdog_mutex);
     return NULL;
 }