Skip to content

Commit 0667fb4

Browse files
committed
rt: Make rust_task::ref_count private
1 parent ae8ea4a commit 0667fb4

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/rt/rust_internal.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ static size_t const BUF_BYTES = 2048;
105105
void deref() { if (--ref_count == 0) { dtor; } }
106106

107107
#define RUST_ATOMIC_REFCOUNT() \
108-
public: \
108+
private: \
109109
intptr_t ref_count; \
110+
public: \
110111
void ref() { \
111112
intptr_t old = sync::increment(ref_count); \
112113
assert(old > 0); \

src/rt/rust_kernel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ rust_kernel::get_task_by_id(rust_task_id id) {
190190
task_table.get(id, &task);
191191
if(task) {
192192
if(task->get_ref_count() == 0) {
193+
// FIXME: I don't think this is possible.
193194
// this means the destructor is running, since the destructor
194195
// grabs the kernel lock to unregister the task. Pretend this
195196
// doesn't actually exist.

src/rt/rust_task_thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ rust_task_thread::reap_dead_tasks() {
149149
void
150150
rust_task_thread::release_task(rust_task *task) {
151151
// Nobody should have a ref to the task at this point
152-
I(this, task->ref_count == 0);
152+
I(this, task->get_ref_count() == 0);
153153
// Kernel should not know about the task any more
154154
I(this, kernel->get_task_by_id(task->id) == NULL);
155155
// Now delete the task, which will require using this thread's

0 commit comments

Comments
 (0)