@@ -61,7 +61,11 @@ struct Mutex {
6161 lock_count : usize ,
6262 /// The queue of threads waiting for this mutex.
6363 queue : VecDeque < ThreadId > ,
64- /// Data race handle
64+ /// Data race handle, this tracks the happens-before
65+ /// relationship between each mutex access. It is
66+ /// released to during unlock and acquired from during
67+ /// locking, and therefore stores the clock of the last
68+ /// thread to release this mutex.
6569 data_race : VClock
6670}
6771
@@ -79,9 +83,24 @@ struct RwLock {
7983 writer_queue : VecDeque < ThreadId > ,
8084 /// The queue of reader threads waiting for this lock.
8185 reader_queue : VecDeque < ThreadId > ,
82- /// Data race handle for writers
86+ /// Data race handle for writers, tracks the happens-before
87+ /// ordering between each write access to a rwlock and is updated
88+ /// after a sequence of concurrent readers to track the happens-
89+ /// before ordering between the set of previous readers and
90+ /// the current writer.
91+ /// Contains the clock of the last thread to release a writer
92+ /// lock or the joined clock of the set of last threads to release
93+ /// shared reader locks.
8394 data_race : VClock ,
84- /// Data race handle for readers
95+ /// Data race handle for readers, this is temporary storage
96+ /// for the combined happens-before ordering for between all
97+ /// concurrent readers and the next writer, and the value
98+ /// is stored to the main data_race variable once all
99+ /// readers are finished.
100+ /// Has to be stored separately since reader lock acquires
101+ /// must load the clock of the last write and must not
102+ /// add happens-before orderings between shared reader
103+ /// locks.
85104 data_race_reader : VClock ,
86105}
87106
@@ -100,13 +119,23 @@ struct CondvarWaiter {
100119#[ derive( Default , Debug ) ]
101120struct Condvar {
102121 waiters : VecDeque < CondvarWaiter > ,
122+ /// Tracks the happens-before relationship
123+ /// between a cond-var signal and a cond-var
124+ /// wait during a non-suprious signal event.
125+ /// Contains the clock of the last thread to
126+ /// perform a futex-signal.
103127 data_race : VClock ,
104128}
105129
106130/// The futex state.
107131#[ derive( Default , Debug ) ]
108132struct Futex {
109133 waiters : VecDeque < FutexWaiter > ,
134+ /// Tracks the happens-before relationship
135+ /// between a futex-wake and a futex-wait
136+ /// during a non-spurious wake event.
137+ /// Contains the clock of the last thread to
138+ /// perform a futex-wake.
110139 data_race : VClock ,
111140}
112141
0 commit comments