-/* INVARIANTS, in this order: bottom/top consistent, reasonable size,
- topBound consistent, space pointer, space accessible to us */
-#define ASSERT_SPARK_POOL_INVARIANTS(p) \
- ASSERT((p)->bottom >= (p)->top); \
- ASSERT((p)->size > 0); \
- ASSERT((p)->size > (p)->bottom - (p)->top); \
- ASSERT((p)->topBound <= (p)->top); \
- ASSERT((p)->elements != NULL); \
- ASSERT(*((p)->elements) || 1); \
- ASSERT(*((p)->elements - 1 + ((p)->size)) || 1);
-
-// missing in old interface. Currently called by initSparkPools
-// internally.
-SparkPool* initPool(StgWord size);
-
-// special case: accessing our own pool, at the write end
-// otherwise, we can always steal from our pool as the others do...
-StgClosure* reclaimSpark(Capability *cap);
-
-rtsBool looksEmpty(SparkPool* deque);
-
-// rest: same as old interface
-StgClosure * findSpark (Capability *cap);
-void initSparkPools (void);
+typedef WSDeque SparkPool;
+
+// Initialisation
+void initSparkPools (void);
+
+// Take a spark from the "write" end of the pool. Can be called
+// by the pool owner only.
+INLINE_HEADER StgClosure* reclaimSpark(SparkPool *pool);
+
+// Returns True if the spark pool is empty (can give a false positive
+// if the pool is almost empty).
+INLINE_HEADER rtsBool looksEmpty(SparkPool* deque);
+
+StgClosure * tryStealSpark (Capability *cap);