rt: Make rust_task::ref_count private

This commit is contained in:
Brian Anderson 2012-02-08 20:52:52 -08:00
parent ae8ea4a78b
commit 0667fb4e63
3 changed files with 4 additions and 2 deletions

View File

@ -105,8 +105,9 @@ static size_t const BUF_BYTES = 2048;
void deref() { if (--ref_count == 0) { dtor; } }
#define RUST_ATOMIC_REFCOUNT() \
public: \
private: \
intptr_t ref_count; \
public: \
void ref() { \
intptr_t old = sync::increment(ref_count); \
assert(old > 0); \

View File

@ -190,6 +190,7 @@ rust_kernel::get_task_by_id(rust_task_id id) {
task_table.get(id, &task);
if(task) {
if(task->get_ref_count() == 0) {
// FIXME: I don't think this is possible.
// this means the destructor is running, since the destructor
// grabs the kernel lock to unregister the task. Pretend this
// doesn't actually exist.

View File

@ -149,7 +149,7 @@ rust_task_thread::reap_dead_tasks() {
void
rust_task_thread::release_task(rust_task *task) {
// 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
I(this, kernel->get_task_by_id(task->id) == NULL);
// Now delete the task, which will require using this thread's