-
Notifications
You must be signed in to change notification settings - Fork 83
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
1 changed file
with
4 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
// Contributors: | ||
// ZettaScale Zenoh Team, <[email protected]> | ||
|
||
#include <limits.h> | ||
#include <pico/rand.h> | ||
#include <stdbool.h> | ||
#include <stddef.h> | ||
|
@@ -135,7 +136,7 @@ z_result_t _z_mutex_try_lock(_z_mutex_t *m) { return xSemaphoreTakeRecursive(*m, | |
z_result_t _z_mutex_unlock(_z_mutex_t *m) { return xSemaphoreGiveRecursive(*m) == pdTRUE ? 0 : -1; } | ||
|
||
/*------------------ CondVar ------------------*/ | ||
static UBaseType_t CONDVAR_MAX_WAITERS_COUNT = 255; | ||
static UBaseType_t CONDVAR_MAX_WAITERS_COUNT = UINT_MAX; | ||
|
||
z_result_t _z_condvar_init(_z_condvar_t *cv) { | ||
if (!cv) { | ||
|
@@ -199,13 +200,11 @@ z_result_t _z_condvar_wait(_z_condvar_t *cv, _z_mutex_t *m) { | |
cv->waiters++; | ||
xSemaphoreGive(cv->mutex); | ||
|
||
xSemaphoreGive(*m); | ||
_z_mutex_unlock(m); | ||
|
||
xSemaphoreTake(cv->sem, portMAX_DELAY); | ||
|
||
xSemaphoreTake(*m, portMAX_DELAY); | ||
|
||
return _Z_RES_OK; | ||
return _z_mutex_lock(m); | ||
} | ||
#endif // Z_MULTI_THREAD == 1 | ||
|
||
|