Skip to content

Commit 0674d43

Browse files
committed
test calling pthread_cond_timedwait with an already elapsed timeout
1 parent bda328e commit 0674d43

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/run-pass/concurrency/libc_pthread_cond.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ fn test_timed_wait_timeout(clock_id: i32) {
3838
let elapsed_time = current_time.elapsed().as_millis();
3939
assert!(900 <= elapsed_time && elapsed_time <= 1300);
4040

41+
// Test calling `pthread_cond_timedwait` again with an already elapsed timeout.
42+
assert_eq!(
43+
libc::pthread_cond_timedwait(&mut cond as *mut _, &mut mutex as *mut _, &timeout),
44+
libc::ETIMEDOUT
45+
);
46+
4147
// Test that invalid nanosecond values (above 10^9 or negative) are rejected with the
4248
// correct error code.
4349
let invalid_timeout_1 = libc::timespec { tv_sec: now.tv_sec + 1, tv_nsec: 1_000_000_000 };

0 commit comments

Comments
 (0)