File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,21 @@ buffer that is carried along in the endpoint data structures.
41
41
42
42
FIXME (#3072) - This is still incomplete
43
43
44
+
45
+
46
+ ## Invariants
47
+
48
+ This section attempts to document the invariants that must hold to
49
+ avoid races. These primarily deal with the state and blocked_task
50
+ fields on packet_headers.
51
+
52
+ 1. If the sender reads a some(task) out of blocked_task, then the task
53
+ that is pointed there will remain live for any events that the sender
54
+ might signal.
55
+
56
+ 2. The sender may only read the blocked_task field if it first ensures
57
+ that the packet's state field is blocked.
58
+
44
59
*/
45
60
46
61
import unsafe:: { forget, reinterpret_cast, transmute} ;
Original file line number Diff line number Diff line change @@ -678,11 +678,11 @@ MUST_CHECK bool rust_task::wait_event(void **result) {
678
678
679
679
void
680
680
rust_task::signal_event (void *event) {
681
- scoped_lock with (lifecycle_lock);
682
-
683
681
assert (task_state_blocked == state ||
684
682
task_state_running == state);
685
683
684
+ scoped_lock with (lifecycle_lock);
685
+
686
686
this ->event = event;
687
687
event_reject = true ;
688
688
if (task_state_blocked == state) {
You can’t perform that action at this time.
0 commit comments