File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,9 @@ bool rust_chan::is_associated() {
51
51
* Unlink this channel from its associated port.
52
52
*/
53
53
void rust_chan::disassociate () {
54
+ // Precondition: port->referent()->lock must be held
54
55
A (kernel, is_associated (),
55
56
" Channel must be associated with a port." );
56
- scoped_lock with (port->referent ()->lock );
57
57
if (port->is_proxy () == false ) {
58
58
KLOG (kernel, task,
59
59
" disassociating chan: 0x%" PRIxPTR " from port: 0x%" PRIxPTR,
@@ -127,6 +127,7 @@ void rust_chan::destroy() {
127
127
// Here is a good place to delete the port proxy we allocated
128
128
// in upcall_clone_chan.
129
129
rust_proxy<rust_port> *proxy = port->as_proxy ();
130
+ scoped_lock with (port->referent ()->lock );
130
131
disassociate ();
131
132
delete proxy;
132
133
} else {
@@ -143,6 +144,7 @@ void rust_chan::destroy() {
143
144
if (buffer.is_empty () == false ) {
144
145
return ;
145
146
}
147
+ scoped_lock with (port->referent ()->lock );
146
148
disassociate ();
147
149
}
148
150
}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ rust_port::~rust_port() {
21
21
22
22
// Disassociate channels from this port.
23
23
while (chans.is_empty () == false ) {
24
+ scoped_lock with (referent ()->lock );
24
25
rust_chan *chan = chans.peek ();
25
26
chan->disassociate ();
26
27
You can’t perform that action at this time.
0 commit comments