Skip to content

Commit 9c34c63

Browse files
committed
Fix comments
1 parent 1f25f53 commit 9c34c63

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/fail-dep/libc/libc_eventfd_write_block.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//@ignore-target-windows: No eventfd on Windows
22
//@ignore-target-apple: No eventfd in macos
33
fn main() {
4-
// eventfd write will block when we try to add until it exceed u64::MAX - 1.
4+
// eventfd write will block when EFD_NONBLOCK flag is clear
5+
// and the addition caused counter to exceed u64::MAX - 1.
56
// This will pass when blocking is implemented.
67
let flags = libc::EFD_CLOEXEC;
78
let fd = unsafe { libc::eventfd(0, flags) };

tests/pass-dep/libc/libc-eventfd.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn test_race() {
103103
let res: i32 = unsafe {
104104
libc::read(fd, buf.as_mut_ptr().cast(), buf.len() as libc::size_t).try_into().unwrap()
105105
};
106-
// read returns number of bytes has been read, which is always 8
106+
// read returns number of bytes has been read, which is always 8.
107107
assert_eq!(res, 8);
108108
let counter: u64;
109109
if cfg!(target_endian = "big") {
@@ -113,10 +113,8 @@ fn test_race() {
113113
counter = u64::from_le_bytes(buf);
114114
}
115115
assert_eq!(counter, 1);
116-
// Read from the static mutable variable
117116
unsafe { assert_eq!(VAL, 1) };
118117
});
119-
// Write to the static mutable variable
120118
unsafe { VAL = 1 };
121119
let data: [u8; 8];
122120
if cfg!(target_endian = "big") {
@@ -127,7 +125,7 @@ fn test_race() {
127125
}
128126
let res: i64 =
129127
unsafe { libc::write(fd, data.as_ptr() as *const libc::c_void, 8).try_into().unwrap() };
130-
// write return number of bytes written, which is always 8
128+
// write returns number of bytes written, which is always 8.
131129
assert_eq!(res, 8);
132130
thread::yield_now();
133131
thread1.join().unwrap();

0 commit comments

Comments
 (0)