diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-03-04 16:52:19 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-03-05 19:39:56 -0800 |
| commit | 1347d04bb086f6d76dd7287762d34ef4c57dbc00 (patch) | |
| tree | 098bfb52a7ed70f543b27d5fe2d72ea89c96b083 /src/rt/rust_builtin.cpp | |
| parent | 4c4a2320eb9620dbc68a264ce64ee1f233dd977d (diff) | |
| download | rust-1347d04bb086f6d76dd7287762d34ef4c57dbc00.tar.gz rust-1347d04bb086f6d76dd7287762d34ef4c57dbc00.zip | |
rt: Properly block tasks while waiting for port detach
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index c37944c3760..14b18a99252 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -482,18 +482,23 @@ new_port(size_t unit_sz) { } extern "C" CDECL void -rust_port_detach(rust_port *port) { +rust_port_begin_detach(rust_port *port, uintptr_t *yield) { rust_task *task = rust_task_thread::get_task(); LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port); - port->detach(); + 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() == 1, "Expected port ref_count == 1"); - port->deref(); + A(task->thread, port->get_ref_count() == 0, "Expected port ref_count == 0"); + delete port; } extern "C" CDECL size_t |
