From 8acadb17c2d679291aa94e94af8cc96513cab830 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Thu, 7 Jul 2011 11:53:08 -0700 Subject: Work on debugging race conditions. Ports and channels have been moved to the kernel pool, since they've been known to outlive their associated task. This probably isn't the right thing to do, the life cycle needs fixed instead. Some refactorying in memory_region.cpp. Added a helper function to increment and decrement the allocation counter. This makes it easier to switch between atomic and non-atomic increments. Using atomic increments for now, although this still does not fix the problem. --- src/rt/rust_task.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rt/rust_task.cpp') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 721f5b0ed20..6c7ab554002 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -401,6 +401,7 @@ rust_task::transition(rust_task_list *src, rust_task_list *dst) { void rust_task::block(rust_cond *on, const char* name) { + scoped_lock with(lock); LOG(this, task, "Blocking on 0x%" PRIxPTR ", cond: 0x%" PRIxPTR, (uintptr_t) on, (uintptr_t) cond); A(sched, cond == NULL, "Cannot block an already blocked task."); @@ -413,6 +414,7 @@ rust_task::block(rust_cond *on, const char* name) { void rust_task::wakeup(rust_cond *from) { + scoped_lock with(lock); A(sched, cond != NULL, "Cannot wake up unblocked task."); LOG(this, task, "Blocked on 0x%" PRIxPTR " woken up on 0x%" PRIxPTR, (uintptr_t) cond, (uintptr_t) from); @@ -430,6 +432,7 @@ rust_task::wakeup(rust_cond *from) { void rust_task::die() { + scoped_lock with(lock); transition(&sched->running_tasks, &sched->dead_tasks); } -- cgit 1.4.1-3-g733a5