Clear locked flag before unlocking mutex, not after.
[crypto.git] / lib / silcutil / unix / silcunixthread.c
index bd551c2990ac4e5a449c7e38ec686c4f80aa705a..2415a380e31eb3bb21509ff4be74b9c58ce07d2b 100644 (file)
@@ -154,8 +154,8 @@ void silc_mutex_unlock(SilcMutex mutex)
 {
 #ifdef SILC_THREADS
   if (mutex) {
-    SILC_VERIFY(pthread_mutex_unlock(&mutex->mutex) == 0);
     mutex->locked = FALSE;
+    SILC_VERIFY(pthread_mutex_unlock(&mutex->mutex) == 0);
   }
 #endif /* SILC_THREADS */
 }