rt: Make rust_task::ref_count private
This commit is contained in:
@@ -105,8 +105,9 @@ static size_t const BUF_BYTES = 2048;
|
|||||||
void deref() { if (--ref_count == 0) { dtor; } }
|
void deref() { if (--ref_count == 0) { dtor; } }
|
||||||
|
|
||||||
#define RUST_ATOMIC_REFCOUNT() \
|
#define RUST_ATOMIC_REFCOUNT() \
|
||||||
public: \
|
private: \
|
||||||
intptr_t ref_count; \
|
intptr_t ref_count; \
|
||||||
|
public: \
|
||||||
void ref() { \
|
void ref() { \
|
||||||
intptr_t old = sync::increment(ref_count); \
|
intptr_t old = sync::increment(ref_count); \
|
||||||
assert(old > 0); \
|
assert(old > 0); \
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ rust_kernel::get_task_by_id(rust_task_id id) {
|
|||||||
task_table.get(id, &task);
|
task_table.get(id, &task);
|
||||||
if(task) {
|
if(task) {
|
||||||
if(task->get_ref_count() == 0) {
|
if(task->get_ref_count() == 0) {
|
||||||
|
// FIXME: I don't think this is possible.
|
||||||
// this means the destructor is running, since the destructor
|
// this means the destructor is running, since the destructor
|
||||||
// grabs the kernel lock to unregister the task. Pretend this
|
// grabs the kernel lock to unregister the task. Pretend this
|
||||||
// doesn't actually exist.
|
// doesn't actually exist.
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ rust_task_thread::reap_dead_tasks() {
|
|||||||
void
|
void
|
||||||
rust_task_thread::release_task(rust_task *task) {
|
rust_task_thread::release_task(rust_task *task) {
|
||||||
// Nobody should have a ref to the task at this point
|
// Nobody should have a ref to the task at this point
|
||||||
I(this, task->ref_count == 0);
|
I(this, task->get_ref_count() == 0);
|
||||||
// Kernel should not know about the task any more
|
// Kernel should not know about the task any more
|
||||||
I(this, kernel->get_task_by_id(task->id) == NULL);
|
I(this, kernel->get_task_by_id(task->id) == NULL);
|
||||||
// Now delete the task, which will require using this thread's
|
// Now delete the task, which will require using this thread's
|
||||||
|
|||||||
Reference in New Issue
Block a user