rt: Move some code from rust_port_detach into rust_port::detach
This commit is contained in:
parent
93fa933a19
commit
8e0efce0da
2 changed files with 6 additions and 6 deletions
|
@ -486,12 +486,6 @@ rust_port_detach(rust_port *port) {
|
||||||
rust_task *task = rust_task_thread::get_task();
|
rust_task *task = rust_task_thread::get_task();
|
||||||
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
|
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
|
||||||
port->detach();
|
port->detach();
|
||||||
// FIXME: Busy waiting until we're the only ref
|
|
||||||
bool done = false;
|
|
||||||
while (!done) {
|
|
||||||
scoped_lock with(task->port_lock);
|
|
||||||
done = port->ref_count == 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CDECL void
|
extern "C" CDECL void
|
||||||
|
|
|
@ -22,6 +22,12 @@ rust_port::~rust_port() {
|
||||||
|
|
||||||
void rust_port::detach() {
|
void rust_port::detach() {
|
||||||
task->release_port(id);
|
task->release_port(id);
|
||||||
|
// FIXME: Busy waiting until we're the only ref
|
||||||
|
bool done = false;
|
||||||
|
while (!done) {
|
||||||
|
scoped_lock with(task->port_lock);
|
||||||
|
done = ref_count == 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rust_port::send(void *sptr) {
|
void rust_port::send(void *sptr) {
|
||||||
|
|
Loading…
Reference in a new issue