about summary refs log tree commit diff
path: root/src/rt/rust_task.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rt/rust_task.cpp')
-rw-r--r--src/rt/rust_task.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 756dc0fbc4d..952e5c8c47d 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -108,7 +108,12 @@ void
 rust_task::delete_this()
 {
     I(thread, !thread->lock.lock_held_by_current_thread());
-    I(thread, port_table.is_empty());
+
+    {
+        scoped_lock with (lock);
+        I(thread, port_table.is_empty());
+    }
+
     DLOG(thread, task, "~rust_task %s @0x%" PRIxPTR ", refcnt=%d",
          name, (uintptr_t)this, ref_count);