rt: Fix the atomic get_ref_count method to avoid races

This commit is contained in:
Brian Anderson
2012-03-05 13:32:40 -08:00
parent 1347d04bb0
commit 958c321083
6 changed files with 12 additions and 20 deletions

View File

@@ -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;
}