MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pthread_cond_wait

Function pthread_cond_wait

components/libc/posix/pthreads/pthread_cond.c:477–496  ·  view source on GitHub ↗

* @brief Waits on a condition variable. * * This function blocks the calling thread on the condition variable `cond` and releases * the associated mutex `mutex`. The thread remains blocked until it is signaled or * broadcast using `pthread_cond_signal` or `pthread_cond_broadcast`. When the thread * is awakened, it re-acquires the mutex and resumes execution. * * @param cond A pointer to the

Source from the content-addressed store, hash-verified

475 * @see pthread_cond_signal, pthread_cond_broadcast, pthread_cond_timedwait, pthread_mutex_lock
476 */
477int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
478{
479 rt_err_t result;
480
481__retry:
482 result = _pthread_cond_timedwait(cond, mutex, RT_WAITING_FOREVER);
483 if (result == RT_EOK)
484 {
485 return 0;
486 }
487 else if (result == -RT_EINTR)
488 {
489 /* https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_wait.html
490 * These functions shall not return an error code of [EINTR].
491 */
492 goto __retry;
493 }
494
495 return EINVAL;
496}
497RTM_EXPORT(pthread_cond_wait);
498
499/**

Callers 8

pthread_barrier_waitFunction · 0.85
pthread_rwlock_rdlockFunction · 0.85
pthread_rwlock_wrlockFunction · 0.85
waitMethod · 0.85
rt_hw_sdl_startFunction · 0.85
libc_ex7Function · 0.85
putFunction · 0.85
getFunction · 0.85

Calls 1

_pthread_cond_timedwaitFunction · 0.85

Tested by

no test coverage detected