LibC: lock mutex when pthread_cond_timedwait times out

This commit is contained in:
Bananymous 2025-08-04 19:07:44 +03:00
parent fa7b58057c
commit 57c9f5a8a8
1 changed files with 3 additions and 0 deletions

View File

@ -1164,7 +1164,10 @@ int pthread_cond_timedwait(pthread_cond_t* __restrict cond, pthread_mutex_t* __r
while (BAN::atomic_load(block.signaled) == 0) while (BAN::atomic_load(block.signaled) == 0)
{ {
if (has_timed_out(abstime, cond->attr.clock)) if (has_timed_out(abstime, cond->attr.clock))
{
pthread_mutex_lock(mutex);
return ETIMEDOUT; return ETIMEDOUT;
}
sched_yield(); sched_yield();
} }