Skip to content

Commit

Permalink
ETIMEDOUT might not be in the esp-idf-sys bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed May 13, 2023
1 parent 075ccf0 commit 1354125
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/private/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use core::time::Duration;

use esp_idf_sys::*;

// Might not always be available in the generated `esp-idf-sys` bindings
const ERR_ETIMEDOUT: esp_err_t = 116;

// NOTE: ESP-IDF-specific
const PTHREAD_MUTEX_INITIALIZER: u32 = 0xFFFFFFFF;

Expand Down Expand Up @@ -90,9 +93,9 @@ impl RawCondvar {
};

let r = pthread_cond_timedwait(self.0.get(), mutex.0.get(), &abstime as *const _);
debug_assert!(r == ETIMEDOUT as i32 || r == 0);
debug_assert!(r == ERR_ETIMEDOUT || r == 0);

r == ETIMEDOUT as i32
r == ERR_ETIMEDOUT
}

pub fn notify_one(&self) {
Expand Down

0 comments on commit 1354125

Please sign in to comment.