Disconnect ports before draining them. Issue #1155
This commit is contained in:
@@ -467,11 +467,24 @@ new_port(size_t unit_sz) {
|
||||
return new (task->kernel, "rust_port") rust_port(task, unit_sz);
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
rust_port_detach(rust_port *port) {
|
||||
rust_task *task = rust_scheduler::get_task();
|
||||
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
|
||||
port->detach();
|
||||
// FIXME: Busy waiting until we're the only ref
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
scoped_lock with(port->lock);
|
||||
done = port->ref_count == 1;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" CDECL void
|
||||
del_port(rust_port *port) {
|
||||
rust_task *task = rust_scheduler::get_task();
|
||||
LOG(task, comm, "del_port(0x%" PRIxPTR ")", (uintptr_t) port);
|
||||
scoped_lock with(task->lock);
|
||||
A(task->sched, port->ref_count == 1, "Expected port ref_count == 1");
|
||||
port->deref();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user