rt: Fix the atomic get_ref_count method to avoid races
This commit is contained in:
@@ -488,16 +488,12 @@ rust_port_begin_detach(rust_port *port, uintptr_t *yield) {
|
||||
port->begin_detach(yield);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_port_end_detach(rust_port *port) {
|
||||
port->end_detach();
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
del_port(rust_port *port) {
|
||||
rust_task *task = rust_task_thread::get_task();
|
||||
LOG(task, comm, "del_port(0x%" PRIxPTR ")", (uintptr_t) port);
|
||||
A(task->thread, port->get_ref_count() == 0, "Expected port ref_count == 0");
|
||||
port->end_detach();
|
||||
delete port;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user