comment tweaks

This commit is contained in:
Ralf Jung 2024-02-12 13:19:49 +01:00
parent c41d5b12b8
commit fe4d3274f0
5 changed files with 10 additions and 11 deletions

View file

@ -70,7 +70,7 @@ struct Mutex {
lock_count: usize,
/// The queue of threads waiting for this mutex.
queue: VecDeque<ThreadId>,
/// Data race handle, this tracks the happens-before
/// Data race handle. This tracks the happens-before
/// relationship between each mutex access. It is
/// released to during unlock and acquired from during
/// locking, and therefore stores the clock of the last
@ -92,7 +92,7 @@ struct RwLock {
writer_queue: VecDeque<ThreadId>,
/// The queue of reader threads waiting for this lock.
reader_queue: VecDeque<ThreadId>,
/// Data race handle for writers, tracks the happens-before
/// Data race handle for writers. Tracks the happens-before
/// ordering between each write access to a rwlock and is updated
/// after a sequence of concurrent readers to track the happens-
/// before ordering between the set of previous readers and
@ -101,7 +101,7 @@ struct RwLock {
/// lock or the joined clock of the set of last threads to release
/// shared reader locks.
data_race: VClock,
/// Data race handle for readers, this is temporary storage
/// Data race handle for readers. This is temporary storage
/// for the combined happens-before ordering for between all
/// concurrent readers and the next writer, and the value
/// is stored to the main data_race variable once all

View file

@ -4,11 +4,11 @@
use std::intrinsics::mir::*;
use std::num::NonZeroI32;
// We define our own option type so that we can control the varian indices.
// We define our own option type so that we can control the variant indices.
#[allow(unused)]
enum Option<T> {
None,
Some(T),
None, // variant 0
Some(T), // variant 1
}
use Option::*;

View file

@ -22,7 +22,7 @@ fn test_timed_wait_timeout(clock_id: i32) {
let mut now_mu: MaybeUninit<libc::timespec> = MaybeUninit::uninit();
assert_eq!(libc::clock_gettime(clock_id, now_mu.as_mut_ptr()), 0);
let now = now_mu.assume_init();
// Waiting for a second... mostly because waiting less requires mich more tricky arithmetic.
// Waiting for a second... mostly because waiting less requires much more tricky arithmetic.
// FIXME: wait less.
let timeout = libc::timespec { tv_sec: now.tv_sec + 1, tv_nsec: now.tv_nsec };

View file

@ -21,7 +21,7 @@ fn test_timed_wait_timeout(clock_id: i32) {
let mut now_mu: MaybeUninit<libc::timespec> = MaybeUninit::uninit();
assert_eq!(libc::clock_gettime(clock_id, now_mu.as_mut_ptr()), 0);
let now = now_mu.assume_init();
// Waiting for a second... mostly because waiting less requires mich more tricky arithmetic.
// Waiting for a second... mostly because waiting less requires much more tricky arithmetic.
// FIXME: wait less.
let timeout = libc::timespec { tv_sec: now.tv_sec + 1, tv_nsec: now.tv_nsec };

View file

@ -98,9 +98,8 @@ fn test_mutex_libc_static_initializer_recursive() {
}
}
// Testing the behavior of std::sync::RwLock does not fully exercise the pthread rwlock shims, we
// need to go a layer deeper and test the behavior of the libc functions, because
// std::sys::unix::rwlock::RWLock itself keeps track of write_locked and num_readers.
// std::sync::RwLock does not even used pthread_rwlock any more.
// Do some smoke testing of the API surface.
fn test_rwlock_libc_static_initializer() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {