1 /* ---------------------------------------------------------------------------
3 * (c) The GHC Team, 2003-2006
7 * A Capability represent the token required to execute STG code,
8 * and all the state an OS thread/task needs to run Haskell code:
9 * its STG registers, a pointer to its TSO, a nursery etc. During
10 * STG execution, a pointer to the capabilitity is kept in a
11 * register (BaseReg; actually it is a pointer to cap->r).
13 * Only in an THREADED_RTS build will there be multiple capabilities,
14 * for non-threaded builds there is only one global capability, namely
17 * --------------------------------------------------------------------------*/
19 #include "PosixSource.h"
24 #include "OSThreads.h"
25 #include "Capability.h"
30 // one global capability, this is the Capability for non-threaded
31 // builds, and for +RTS -N1
32 Capability MainCapability;
35 Capability *capabilities = NULL;
37 // Holds the Capability which last became free. This is used so that
38 // an in-call has a chance of quickly finding a free Capability.
39 // Maintaining a global free list of Capabilities would require global
40 // locking, so we don't do that.
41 Capability *last_free_capability;
43 /* GC indicator, in scope for the scheduler, init'ed to false */
44 volatile StgWord waiting_for_gc = 0;
46 #if defined(THREADED_RTS)
50 return blackholes_need_checking
51 || sched_state >= SCHED_INTERRUPTING
56 #if defined(THREADED_RTS)
58 findSpark (Capability *cap)
60 /* use the normal Sparks.h interface (internally modified to enable
62 and immediately turn the spark into a thread when successful
69 // first try to get a spark from our own pool.
70 // We should be using reclaimSpark(), because it works without
71 // needing any atomic instructions:
72 // spark = reclaimSpark(cap->sparks);
73 // However, measurements show that this makes at least one benchmark
74 // slower (prsa) and doesn't affect the others.
75 spark = tryStealSpark(cap);
77 cap->sparks_converted++;
81 if (n_capabilities == 1) { return NULL; } // makes no sense...
83 debugTrace(DEBUG_sched,
84 "cap %d: Trying to steal work from other capabilities",
90 /* visit cap.s 0..n-1 in sequence until a theft succeeds. We could
91 start at a random place instead of 0 as well. */
92 for ( i=0 ; i < n_capabilities ; i++ ) {
93 robbed = &capabilities[i];
94 if (cap == robbed) // ourselves...
97 if (emptySparkPoolCap(robbed)) // nothing to steal here
100 spark = tryStealSpark(robbed);
101 if (spark == NULL && !emptySparkPoolCap(robbed)) {
102 // we conflicted with another thread while trying to steal;
108 debugTrace(DEBUG_sched,
109 "cap %d: Stole a spark from capability %d",
110 cap->no, robbed->no);
111 cap->sparks_converted++;
114 // otherwise: no success, try next one
118 debugTrace(DEBUG_sched, "No sparks stolen");
122 // Returns True if any spark pool is non-empty at this moment in time
123 // The result is only valid for an instant, of course, so in a sense
124 // is immediately invalid, and should not be relied upon for
131 for (i=0; i < n_capabilities; i++) {
132 if (!emptySparkPoolCap(&capabilities[i])) {
140 /* -----------------------------------------------------------------------------
141 * Manage the returning_tasks lists.
143 * These functions require cap->lock
144 * -------------------------------------------------------------------------- */
146 #if defined(THREADED_RTS)
148 newReturningTask (Capability *cap, Task *task)
150 ASSERT_LOCK_HELD(&cap->lock);
151 ASSERT(task->return_link == NULL);
152 if (cap->returning_tasks_hd) {
153 ASSERT(cap->returning_tasks_tl->return_link == NULL);
154 cap->returning_tasks_tl->return_link = task;
156 cap->returning_tasks_hd = task;
158 cap->returning_tasks_tl = task;
162 popReturningTask (Capability *cap)
164 ASSERT_LOCK_HELD(&cap->lock);
166 task = cap->returning_tasks_hd;
168 cap->returning_tasks_hd = task->return_link;
169 if (!cap->returning_tasks_hd) {
170 cap->returning_tasks_tl = NULL;
172 task->return_link = NULL;
177 /* ----------------------------------------------------------------------------
180 * The Capability is initially marked not free.
181 * ------------------------------------------------------------------------- */
184 initCapability( Capability *cap, nat i )
189 cap->in_haskell = rtsFalse;
191 cap->run_queue_hd = END_TSO_QUEUE;
192 cap->run_queue_tl = END_TSO_QUEUE;
194 #if defined(THREADED_RTS)
195 initMutex(&cap->lock);
196 cap->running_task = NULL; // indicates cap is free
197 cap->spare_workers = NULL;
198 cap->suspended_ccalling_tasks = NULL;
199 cap->returning_tasks_hd = NULL;
200 cap->returning_tasks_tl = NULL;
201 cap->wakeup_queue_hd = END_TSO_QUEUE;
202 cap->wakeup_queue_tl = END_TSO_QUEUE;
203 cap->sparks_created = 0;
204 cap->sparks_converted = 0;
205 cap->sparks_pruned = 0;
208 cap->f.stgEagerBlackholeInfo = (W_)&__stg_EAGER_BLACKHOLE_info;
209 cap->f.stgGCEnter1 = (F_)__stg_gc_enter_1;
210 cap->f.stgGCFun = (F_)__stg_gc_fun;
212 cap->mut_lists = stgMallocBytes(sizeof(bdescr *) *
213 RtsFlags.GcFlags.generations,
216 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
217 cap->mut_lists[g] = NULL;
220 cap->free_tvar_watch_queues = END_STM_WATCH_QUEUE;
221 cap->free_invariant_check_queues = END_INVARIANT_CHECK_QUEUE;
222 cap->free_trec_chunks = END_STM_CHUNK_LIST;
223 cap->free_trec_headers = NO_TREC;
224 cap->transaction_tokens = 0;
225 cap->context_switch = 0;
228 /* ---------------------------------------------------------------------------
229 * Function: initCapabilities()
231 * Purpose: set up the Capability handling. For the THREADED_RTS build,
232 * we keep a table of them, the size of which is
233 * controlled by the user via the RTS flag -N.
235 * ------------------------------------------------------------------------- */
237 initCapabilities( void )
239 #if defined(THREADED_RTS)
243 // We can't support multiple CPUs if BaseReg is not a register
244 if (RtsFlags.ParFlags.nNodes > 1) {
245 errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
246 RtsFlags.ParFlags.nNodes = 1;
250 n_capabilities = RtsFlags.ParFlags.nNodes;
252 if (n_capabilities == 1) {
253 capabilities = &MainCapability;
254 // THREADED_RTS must work on builds that don't have a mutable
255 // BaseReg (eg. unregisterised), so in this case
256 // capabilities[0] must coincide with &MainCapability.
258 capabilities = stgMallocBytes(n_capabilities * sizeof(Capability),
262 for (i = 0; i < n_capabilities; i++) {
263 initCapability(&capabilities[i], i);
266 debugTrace(DEBUG_sched, "allocated %d capabilities", n_capabilities);
268 #else /* !THREADED_RTS */
271 capabilities = &MainCapability;
272 initCapability(&MainCapability, 0);
276 // There are no free capabilities to begin with. We will start
277 // a worker Task to each Capability, which will quickly put the
278 // Capability on the free list when it finds nothing to do.
279 last_free_capability = &capabilities[0];
282 /* ----------------------------------------------------------------------------
283 * setContextSwitches: cause all capabilities to context switch as
285 * ------------------------------------------------------------------------- */
287 void setContextSwitches(void)
290 for (i=0; i < n_capabilities; i++) {
291 capabilities[i].context_switch = 1;
295 /* ----------------------------------------------------------------------------
296 * Give a Capability to a Task. The task must currently be sleeping
297 * on its condition variable.
299 * Requires cap->lock (modifies cap->running_task).
301 * When migrating a Task, the migrater must take task->lock before
302 * modifying task->cap, to synchronise with the waking up Task.
303 * Additionally, the migrater should own the Capability (when
304 * migrating the run queue), or cap->lock (when migrating
305 * returning_workers).
307 * ------------------------------------------------------------------------- */
309 #if defined(THREADED_RTS)
311 giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
313 ASSERT_LOCK_HELD(&cap->lock);
314 ASSERT(task->cap == cap);
315 trace(TRACE_sched | DEBUG_sched,
316 "passing capability %d to %s %p",
317 cap->no, task->tso ? "bound task" : "worker",
319 ACQUIRE_LOCK(&task->lock);
320 task->wakeup = rtsTrue;
321 // the wakeup flag is needed because signalCondition() doesn't
322 // flag the condition if the thread is already runniing, but we want
324 signalCondition(&task->cond);
325 RELEASE_LOCK(&task->lock);
329 /* ----------------------------------------------------------------------------
330 * Function: releaseCapability(Capability*)
332 * Purpose: Letting go of a capability. Causes a
333 * 'returning worker' thread or a 'waiting worker'
334 * to wake up, in that order.
335 * ------------------------------------------------------------------------- */
337 #if defined(THREADED_RTS)
339 releaseCapability_ (Capability* cap,
340 rtsBool always_wakeup)
344 task = cap->running_task;
346 ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task);
348 cap->running_task = NULL;
350 // Check to see whether a worker thread can be given
351 // the go-ahead to return the result of an external call..
352 if (cap->returning_tasks_hd != NULL) {
353 giveCapabilityToTask(cap,cap->returning_tasks_hd);
354 // The Task pops itself from the queue (see waitForReturnCapability())
358 /* if waiting_for_gc was the reason to release the cap: thread
359 comes from yieldCap->releaseAndQueueWorker. Unconditionally set
360 cap. free and return (see default after the if-protected other
361 special cases). Thread will wait on cond.var and re-acquire the
362 same cap after GC (GC-triggering cap. calls releaseCap and
363 enters the spare_workers case)
365 if (waiting_for_gc) {
366 last_free_capability = cap; // needed?
367 trace(TRACE_sched | DEBUG_sched,
368 "GC pending, set capability %d free", cap->no);
373 // If the next thread on the run queue is a bound thread,
374 // give this Capability to the appropriate Task.
375 if (!emptyRunQueue(cap) && cap->run_queue_hd->bound) {
376 // Make sure we're not about to try to wake ourselves up
377 ASSERT(task != cap->run_queue_hd->bound);
378 task = cap->run_queue_hd->bound;
379 giveCapabilityToTask(cap,task);
383 if (!cap->spare_workers) {
384 // Create a worker thread if we don't have one. If the system
385 // is interrupted, we only create a worker task if there
386 // are threads that need to be completed. If the system is
387 // shutting down, we never create a new worker.
388 if (sched_state < SCHED_SHUTTING_DOWN || !emptyRunQueue(cap)) {
389 debugTrace(DEBUG_sched,
390 "starting new worker on capability %d", cap->no);
391 startWorkerTask(cap, workerStart);
396 // If we have an unbound thread on the run queue, or if there's
397 // anything else to do, give the Capability to a worker thread.
399 !emptyRunQueue(cap) || !emptyWakeupQueue(cap) ||
400 !emptySparkPoolCap(cap) || globalWorkToDo()) {
401 if (cap->spare_workers) {
402 giveCapabilityToTask(cap,cap->spare_workers);
403 // The worker Task pops itself from the queue;
408 last_free_capability = cap;
409 trace(TRACE_sched | DEBUG_sched, "freeing capability %d", cap->no);
413 releaseCapability (Capability* cap USED_IF_THREADS)
415 ACQUIRE_LOCK(&cap->lock);
416 releaseCapability_(cap, rtsFalse);
417 RELEASE_LOCK(&cap->lock);
421 releaseAndWakeupCapability (Capability* cap USED_IF_THREADS)
423 ACQUIRE_LOCK(&cap->lock);
424 releaseCapability_(cap, rtsTrue);
425 RELEASE_LOCK(&cap->lock);
429 releaseCapabilityAndQueueWorker (Capability* cap USED_IF_THREADS)
433 ACQUIRE_LOCK(&cap->lock);
435 task = cap->running_task;
437 // If the current task is a worker, save it on the spare_workers
438 // list of this Capability. A worker can mark itself as stopped,
439 // in which case it is not replaced on the spare_worker queue.
440 // This happens when the system is shutting down (see
441 // Schedule.c:workerStart()).
442 // Also, be careful to check that this task hasn't just exited
443 // Haskell to do a foreign call (task->suspended_tso).
444 if (!isBoundTask(task) && !task->stopped && !task->suspended_tso) {
445 task->next = cap->spare_workers;
446 cap->spare_workers = task;
448 // Bound tasks just float around attached to their TSOs.
450 releaseCapability_(cap,rtsFalse);
452 RELEASE_LOCK(&cap->lock);
456 /* ----------------------------------------------------------------------------
457 * waitForReturnCapability( Task *task )
459 * Purpose: when an OS thread returns from an external call,
460 * it calls waitForReturnCapability() (via Schedule.resumeThread())
461 * to wait for permission to enter the RTS & communicate the
462 * result of the external call back to the Haskell thread that
465 * ------------------------------------------------------------------------- */
467 waitForReturnCapability (Capability **pCap, Task *task)
469 #if !defined(THREADED_RTS)
471 MainCapability.running_task = task;
472 task->cap = &MainCapability;
473 *pCap = &MainCapability;
476 Capability *cap = *pCap;
479 // Try last_free_capability first
480 cap = last_free_capability;
481 if (!cap->running_task) {
483 // otherwise, search for a free capability
484 for (i = 0; i < n_capabilities; i++) {
485 cap = &capabilities[i];
486 if (!cap->running_task) {
490 // Can't find a free one, use last_free_capability.
491 cap = last_free_capability;
494 // record the Capability as the one this Task is now assocated with.
498 ASSERT(task->cap == cap);
501 ACQUIRE_LOCK(&cap->lock);
503 debugTrace(DEBUG_sched, "returning; I want capability %d", cap->no);
505 if (!cap->running_task) {
506 // It's free; just grab it
507 cap->running_task = task;
508 RELEASE_LOCK(&cap->lock);
510 newReturningTask(cap,task);
511 RELEASE_LOCK(&cap->lock);
514 ACQUIRE_LOCK(&task->lock);
515 // task->lock held, cap->lock not held
516 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
518 task->wakeup = rtsFalse;
519 RELEASE_LOCK(&task->lock);
521 // now check whether we should wake up...
522 ACQUIRE_LOCK(&cap->lock);
523 if (cap->running_task == NULL) {
524 if (cap->returning_tasks_hd != task) {
525 giveCapabilityToTask(cap,cap->returning_tasks_hd);
526 RELEASE_LOCK(&cap->lock);
529 cap->running_task = task;
530 popReturningTask(cap);
531 RELEASE_LOCK(&cap->lock);
534 RELEASE_LOCK(&cap->lock);
539 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
541 trace(TRACE_sched | DEBUG_sched, "resuming capability %d", cap->no);
547 #if defined(THREADED_RTS)
548 /* ----------------------------------------------------------------------------
550 * ------------------------------------------------------------------------- */
553 yieldCapability (Capability** pCap, Task *task)
555 Capability *cap = *pCap;
557 debugTrace(DEBUG_sched, "giving up capability %d", cap->no);
559 // We must now release the capability and wait to be woken up
561 task->wakeup = rtsFalse;
562 releaseCapabilityAndQueueWorker(cap);
565 ACQUIRE_LOCK(&task->lock);
566 // task->lock held, cap->lock not held
567 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
569 task->wakeup = rtsFalse;
570 RELEASE_LOCK(&task->lock);
572 debugTrace(DEBUG_sched, "woken up on capability %d", cap->no);
574 ACQUIRE_LOCK(&cap->lock);
575 if (cap->running_task != NULL) {
576 debugTrace(DEBUG_sched,
577 "capability %d is owned by another task", cap->no);
578 RELEASE_LOCK(&cap->lock);
582 if (task->tso == NULL) {
583 ASSERT(cap->spare_workers != NULL);
584 // if we're not at the front of the queue, release it
585 // again. This is unlikely to happen.
586 if (cap->spare_workers != task) {
587 giveCapabilityToTask(cap,cap->spare_workers);
588 RELEASE_LOCK(&cap->lock);
591 cap->spare_workers = task->next;
594 cap->running_task = task;
595 RELEASE_LOCK(&cap->lock);
599 trace(TRACE_sched | DEBUG_sched, "resuming capability %d", cap->no);
600 ASSERT(cap->running_task == task);
604 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
609 /* ----------------------------------------------------------------------------
610 * Wake up a thread on a Capability.
612 * This is used when the current Task is running on a Capability and
613 * wishes to wake up a thread on a different Capability.
614 * ------------------------------------------------------------------------- */
617 wakeupThreadOnCapability (Capability *my_cap,
618 Capability *other_cap,
621 ACQUIRE_LOCK(&other_cap->lock);
623 // ASSUMES: cap->lock is held (asserted in wakeupThreadOnCapability)
625 ASSERT(tso->bound->cap == tso->cap);
626 tso->bound->cap = other_cap;
628 tso->cap = other_cap;
630 ASSERT(tso->bound ? tso->bound->cap == other_cap : 1);
632 if (other_cap->running_task == NULL) {
633 // nobody is running this Capability, we can add our thread
634 // directly onto the run queue and start up a Task to run it.
636 other_cap->running_task = myTask();
637 // precond for releaseCapability_() and appendToRunQueue()
639 appendToRunQueue(other_cap,tso);
641 trace(TRACE_sched, "resuming capability %d", other_cap->no);
642 releaseCapability_(other_cap,rtsFalse);
644 appendToWakeupQueue(my_cap,other_cap,tso);
645 other_cap->context_switch = 1;
646 // someone is running on this Capability, so it cannot be
647 // freed without first checking the wakeup queue (see
648 // releaseCapability_).
651 RELEASE_LOCK(&other_cap->lock);
654 /* ----------------------------------------------------------------------------
657 * Used to indicate that the interrupted flag is now set, or some
658 * other global condition that might require waking up a Task on each
660 * ------------------------------------------------------------------------- */
663 prodCapabilities(rtsBool all)
669 for (i=0; i < n_capabilities; i++) {
670 cap = &capabilities[i];
671 ACQUIRE_LOCK(&cap->lock);
672 if (!cap->running_task) {
673 if (cap->spare_workers) {
674 trace(TRACE_sched, "resuming capability %d", cap->no);
675 task = cap->spare_workers;
676 ASSERT(!task->stopped);
677 giveCapabilityToTask(cap,task);
679 RELEASE_LOCK(&cap->lock);
684 RELEASE_LOCK(&cap->lock);
690 prodAllCapabilities (void)
692 prodCapabilities(rtsTrue);
695 /* ----------------------------------------------------------------------------
698 * Like prodAllCapabilities, but we only require a single Task to wake
699 * up in order to service some global event, such as checking for
700 * deadlock after some idle time has passed.
701 * ------------------------------------------------------------------------- */
704 prodOneCapability (void)
706 prodCapabilities(rtsFalse);
709 /* ----------------------------------------------------------------------------
712 * At shutdown time, we want to let everything exit as cleanly as
713 * possible. For each capability, we let its run queue drain, and
714 * allow the workers to stop.
716 * This function should be called when interrupted and
717 * shutting_down_scheduler = rtsTrue, thus any worker that wakes up
718 * will exit the scheduler and call taskStop(), and any bound thread
719 * that wakes up will return to its caller. Runnable threads are
722 * ------------------------------------------------------------------------- */
725 shutdownCapability (Capability *cap, Task *task, rtsBool safe)
731 // Loop indefinitely until all the workers have exited and there
732 // are no Haskell threads left. We used to bail out after 50
733 // iterations of this loop, but that occasionally left a worker
734 // running which caused problems later (the closeMutex() below
735 // isn't safe, for one thing).
737 for (i = 0; /* i < 50 */; i++) {
738 ASSERT(sched_state == SCHED_SHUTTING_DOWN);
740 debugTrace(DEBUG_sched,
741 "shutting down capability %d, attempt %d", cap->no, i);
742 ACQUIRE_LOCK(&cap->lock);
743 if (cap->running_task) {
744 RELEASE_LOCK(&cap->lock);
745 debugTrace(DEBUG_sched, "not owner, yielding");
749 cap->running_task = task;
751 if (cap->spare_workers) {
752 // Look for workers that have died without removing
753 // themselves from the list; this could happen if the OS
754 // summarily killed the thread, for example. This
755 // actually happens on Windows when the system is
756 // terminating the program, and the RTS is running in a
760 for (t = cap->spare_workers; t != NULL; t = t->next) {
761 if (!osThreadIsAlive(t->id)) {
762 debugTrace(DEBUG_sched,
763 "worker thread %p has died unexpectedly", (void *)t->id);
765 cap->spare_workers = t->next;
767 prev->next = t->next;
774 if (!emptyRunQueue(cap) || cap->spare_workers) {
775 debugTrace(DEBUG_sched,
776 "runnable threads or workers still alive, yielding");
777 releaseCapability_(cap,rtsFalse); // this will wake up a worker
778 RELEASE_LOCK(&cap->lock);
783 // If "safe", then busy-wait for any threads currently doing
784 // foreign calls. If we're about to unload this DLL, for
785 // example, we need to be sure that there are no OS threads
786 // that will try to return to code that has been unloaded.
787 // We can be a bit more relaxed when this is a standalone
788 // program that is about to terminate, and let safe=false.
789 if (cap->suspended_ccalling_tasks && safe) {
790 debugTrace(DEBUG_sched,
791 "thread(s) are involved in foreign calls, yielding");
792 cap->running_task = NULL;
793 RELEASE_LOCK(&cap->lock);
798 debugTrace(DEBUG_sched, "capability %d is stopped.", cap->no);
799 RELEASE_LOCK(&cap->lock);
802 // we now have the Capability, its run queue and spare workers
803 // list are both empty.
805 // ToDo: we can't drop this mutex, because there might still be
806 // threads performing foreign calls that will eventually try to
807 // return via resumeThread() and attempt to grab cap->lock.
808 // closeMutex(&cap->lock);
811 /* ----------------------------------------------------------------------------
814 * Attempt to gain control of a Capability if it is free.
816 * ------------------------------------------------------------------------- */
819 tryGrabCapability (Capability *cap, Task *task)
821 if (cap->running_task != NULL) return rtsFalse;
822 ACQUIRE_LOCK(&cap->lock);
823 if (cap->running_task != NULL) {
824 RELEASE_LOCK(&cap->lock);
828 cap->running_task = task;
829 RELEASE_LOCK(&cap->lock);
834 #endif /* THREADED_RTS */
837 freeCapability (Capability *cap)
839 stgFree(cap->mut_lists);
840 #if defined(THREADED_RTS) || defined(PARALLEL_HASKELL)
841 freeSparkPool(cap->sparks);
846 freeCapabilities (void)
848 #if defined(THREADED_RTS)
850 for (i=0; i < n_capabilities; i++) {
851 freeCapability(&capabilities[i]);
854 freeCapability(&MainCapability);
858 /* ---------------------------------------------------------------------------
859 Mark everything directly reachable from the Capabilities. When
860 using multiple GC threads, each GC thread marks all Capabilities
861 for which (c `mod` n == 0), for Capability c and thread n.
862 ------------------------------------------------------------------------ */
865 markSomeCapabilities (evac_fn evac, void *user, nat i0, nat delta,
866 rtsBool prune_sparks USED_IF_THREADS)
872 // Each GC thread is responsible for following roots from the
873 // Capability of the same number. There will usually be the same
874 // or fewer Capabilities as GC threads, but just in case there
875 // are more, we mark every Capability whose number is the GC
876 // thread's index plus a multiple of the number of GC threads.
877 for (i = i0; i < n_capabilities; i += delta) {
878 cap = &capabilities[i];
879 evac(user, (StgClosure **)(void *)&cap->run_queue_hd);
880 evac(user, (StgClosure **)(void *)&cap->run_queue_tl);
881 #if defined(THREADED_RTS)
882 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_hd);
883 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_tl);
885 for (task = cap->suspended_ccalling_tasks; task != NULL;
887 debugTrace(DEBUG_sched,
888 "evac'ing suspended TSO %lu", (unsigned long)task->suspended_tso->id);
889 evac(user, (StgClosure **)(void *)&task->suspended_tso);
892 #if defined(THREADED_RTS)
894 pruneSparkQueue (evac, user, cap);
896 traverseSparkQueue (evac, user, cap);
901 #if !defined(THREADED_RTS)
902 evac(user, (StgClosure **)(void *)&blocked_queue_hd);
903 evac(user, (StgClosure **)(void *)&blocked_queue_tl);
904 evac(user, (StgClosure **)(void *)&sleeping_queue);
909 markCapabilities (evac_fn evac, void *user)
911 markSomeCapabilities(evac, user, 0, 1, rtsFalse);