-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
|
||
#include <errno.h> | ||
#include <stddef.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
@@ -143,8 +144,20 @@ z_result_t _z_condvar_signal_all(_z_condvar_t *cv) { _Z_CHECK_SYS_ERR(pthread_co | |
|
||
z_result_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { _Z_CHECK_SYS_ERR(pthread_cond_wait(cv, m)); } | ||
|
||
z_result_t _z_condvar_timedwait(_z_condvar_t *cv, _z_mutex_t *m, const z_clock_t *abstime) { | ||
_Z_CHECK_SYS_ERR(pthread_cond_timedwait(cv, m, abstime)); | ||
z_result_t _z_condvar_wait_until(_z_condvar_t *cv, _z_mutex_t *m, const z_clock_t *abstime, bool *timeout) { | ||
int error = pthread_cond_timedwait(cv, m, abstime); | ||
|
||
if (error == ETIMEDOUT) { | ||
if (timeout != NULL) { | ||
*timeout = true; | ||
} | ||
return 0; | ||
} | ||
|
||
if (timeout != NULL) { | ||
*timeout = false; | ||
} | ||
_Z_CHECK_SYS_ERR(error); | ||
} | ||
#endif // Z_FEATURE_MULTI_THREAD == 1 | ||
|
||
|