]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
htl: make __pthread_hurd_cond_timedwait_internal check mutex is held
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 22 Aug 2022 20:25:27 +0000 (22:25 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 22 Aug 2022 20:25:27 +0000 (22:25 +0200)
Like __pthread_cond_timedwait_internal already does.

sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c

index d81f0a2d8dc820ab604cae43f9ad378d1bfef44a..16f0d3b3099260b42e497f1fa312f9196c20d8ca 100644 (file)
@@ -73,6 +73,10 @@ __pthread_hurd_cond_timedwait_internal (pthread_cond_t *cond,
   if (abstime != NULL && ! valid_nanoseconds (abstime->tv_nsec))
     return EINVAL;
 
+  err = __pthread_mutex_checklocked (mutex);
+  if (err)
+    return err;
+
   /* Atomically enqueue our thread on the condition variable's queue of
      waiters, and mark our sigstate to indicate that `cancel_me' must be
      called to wake us up.  We must hold the sigstate lock while acquiring