[project @ 2005-10-26 15:36:06 by simonmar]
[ghc-hetmet.git] / ghc / rts / Capability.h
index 875f3e7..b559dcd 100644 (file)
@@ -61,9 +61,6 @@ struct Capability_ {
     Task *suspended_ccalling_tasks;
 
 #if defined(THREADED_RTS)
-    struct Capability_ *next;
-    struct Capability_ *prev;
-
     // Worker Tasks waiting in the wings.  Singly-linked.
     Task *spare_workers;
 
@@ -80,6 +77,17 @@ struct Capability_ {
 #endif
 }; // typedef Capability, defined in RtsAPI.h
 
+
+// These properties should be true when a Task is holding a Capability
+#define ASSERT_CAPABILITY_INVARIANTS(cap,task)                         \
+  ASSERT(cap->running_task != NULL && cap->running_task == task);      \
+  ASSERT(task->cap == cap);                                            \
+  ASSERT(cap->run_queue_hd == END_TSO_QUEUE ?                          \
+           cap->run_queue_tl == END_TSO_QUEUE : 1);                    \
+  ASSERT(myTask() == task);                                            \
+  ASSERT(task->id == osThreadId());
+
+
 // Converts a *StgRegTable into a *Capability.
 //
 INLINE_HEADER Capability *