Skip to content

Commit 8e0efce

Browse files
committed
rt: Move some code from rust_port_detach into rust_port::detach
1 parent 93fa933 commit 8e0efce

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/rt/rust_builtin.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,6 @@ rust_port_detach(rust_port *port) {
486486
rust_task *task = rust_task_thread::get_task();
487487
LOG(task, comm, "rust_port_detach(0x%" PRIxPTR ")", (uintptr_t) port);
488488
port->detach();
489-
// FIXME: Busy waiting until we're the only ref
490-
bool done = false;
491-
while (!done) {
492-
scoped_lock with(task->port_lock);
493-
done = port->ref_count == 1;
494-
}
495489
}
496490

497491
extern "C" CDECL void

src/rt/rust_port.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ rust_port::~rust_port() {
2222

2323
void rust_port::detach() {
2424
task->release_port(id);
25+
// FIXME: Busy waiting until we're the only ref
26+
bool done = false;
27+
while (!done) {
28+
scoped_lock with(task->port_lock);
29+
done = ref_count == 1;
30+
}
2531
}
2632

2733
void rust_port::send(void *sptr) {

0 commit comments

Comments
 (0)