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"
22 #include "Capability.h"
26 #include "sm/GC.h" // for gcWorkerThread()
30 // one global capability, this is the Capability for non-threaded
31 // builds, and for +RTS -N1
32 Capability MainCapability;
34 nat n_capabilities = 0;
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 = NULL;
43 /* GC indicator, in scope for the scheduler, init'ed to false */
44 volatile StgWord waiting_for_gc = 0;
46 /* Let foreign code get the current Capability -- assuming there is one!
47 * This is useful for unsafe foreign calls because they are called with
48 * the current Capability held, but they are not passed it. For example,
49 * see see the integer-gmp package which calls allocateLocal() in its
50 * stgAllocForGMP() function (which gets called by gmp functions).
52 Capability * rts_unsafeGetMyCapability (void)
54 #if defined(THREADED_RTS)
57 return &MainCapability;
61 #if defined(THREADED_RTS)
65 return blackholes_need_checking
66 || sched_state >= SCHED_INTERRUPTING
71 #if defined(THREADED_RTS)
73 findSpark (Capability *cap)
80 if (!emptyRunQueue(cap) || cap->returning_tasks_hd != NULL) {
81 // If there are other threads, don't try to run any new
82 // sparks: sparks might be speculative, we don't want to take
83 // resources away from the main computation.
90 // first try to get a spark from our own pool.
91 // We should be using reclaimSpark(), because it works without
92 // needing any atomic instructions:
93 // spark = reclaimSpark(cap->sparks);
94 // However, measurements show that this makes at least one benchmark
95 // slower (prsa) and doesn't affect the others.
96 spark = tryStealSpark(cap);
98 cap->sparks_converted++;
100 // Post event for running a spark from capability's own pool.
101 traceEventRunSpark(cap, cap->r.rCurrentTSO);
105 if (!emptySparkPoolCap(cap)) {
109 if (n_capabilities == 1) { return NULL; } // makes no sense...
111 debugTrace(DEBUG_sched,
112 "cap %d: Trying to steal work from other capabilities",
115 /* visit cap.s 0..n-1 in sequence until a theft succeeds. We could
116 start at a random place instead of 0 as well. */
117 for ( i=0 ; i < n_capabilities ; i++ ) {
118 robbed = &capabilities[i];
119 if (cap == robbed) // ourselves...
122 if (emptySparkPoolCap(robbed)) // nothing to steal here
125 spark = tryStealSpark(robbed);
126 if (spark == NULL && !emptySparkPoolCap(robbed)) {
127 // we conflicted with another thread while trying to steal;
133 cap->sparks_converted++;
135 traceEventStealSpark(cap, cap->r.rCurrentTSO, robbed->no);
139 // otherwise: no success, try next one
143 debugTrace(DEBUG_sched, "No sparks stolen");
147 // Returns True if any spark pool is non-empty at this moment in time
148 // The result is only valid for an instant, of course, so in a sense
149 // is immediately invalid, and should not be relied upon for
156 for (i=0; i < n_capabilities; i++) {
157 if (!emptySparkPoolCap(&capabilities[i])) {
165 /* -----------------------------------------------------------------------------
166 * Manage the returning_tasks lists.
168 * These functions require cap->lock
169 * -------------------------------------------------------------------------- */
171 #if defined(THREADED_RTS)
173 newReturningTask (Capability *cap, Task *task)
175 ASSERT_LOCK_HELD(&cap->lock);
176 ASSERT(task->return_link == NULL);
177 if (cap->returning_tasks_hd) {
178 ASSERT(cap->returning_tasks_tl->return_link == NULL);
179 cap->returning_tasks_tl->return_link = task;
181 cap->returning_tasks_hd = task;
183 cap->returning_tasks_tl = task;
187 popReturningTask (Capability *cap)
189 ASSERT_LOCK_HELD(&cap->lock);
191 task = cap->returning_tasks_hd;
193 cap->returning_tasks_hd = task->return_link;
194 if (!cap->returning_tasks_hd) {
195 cap->returning_tasks_tl = NULL;
197 task->return_link = NULL;
202 /* ----------------------------------------------------------------------------
205 * The Capability is initially marked not free.
206 * ------------------------------------------------------------------------- */
209 initCapability( Capability *cap, nat i )
214 cap->in_haskell = rtsFalse;
216 cap->run_queue_hd = END_TSO_QUEUE;
217 cap->run_queue_tl = END_TSO_QUEUE;
219 #if defined(THREADED_RTS)
220 initMutex(&cap->lock);
221 cap->running_task = NULL; // indicates cap is free
222 cap->spare_workers = NULL;
223 cap->suspended_ccalling_tasks = NULL;
224 cap->returning_tasks_hd = NULL;
225 cap->returning_tasks_tl = NULL;
226 cap->wakeup_queue_hd = END_TSO_QUEUE;
227 cap->wakeup_queue_tl = END_TSO_QUEUE;
228 cap->sparks_created = 0;
229 cap->sparks_converted = 0;
230 cap->sparks_pruned = 0;
233 cap->f.stgEagerBlackholeInfo = (W_)&__stg_EAGER_BLACKHOLE_info;
234 cap->f.stgGCEnter1 = (StgFunPtr)__stg_gc_enter_1;
235 cap->f.stgGCFun = (StgFunPtr)__stg_gc_fun;
237 cap->mut_lists = stgMallocBytes(sizeof(bdescr *) *
238 RtsFlags.GcFlags.generations,
240 cap->saved_mut_lists = stgMallocBytes(sizeof(bdescr *) *
241 RtsFlags.GcFlags.generations,
244 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
245 cap->mut_lists[g] = NULL;
248 cap->free_tvar_watch_queues = END_STM_WATCH_QUEUE;
249 cap->free_invariant_check_queues = END_INVARIANT_CHECK_QUEUE;
250 cap->free_trec_chunks = END_STM_CHUNK_LIST;
251 cap->free_trec_headers = NO_TREC;
252 cap->transaction_tokens = 0;
253 cap->context_switch = 0;
254 cap->pinned_object_block = NULL;
257 /* ---------------------------------------------------------------------------
258 * Function: initCapabilities()
260 * Purpose: set up the Capability handling. For the THREADED_RTS build,
261 * we keep a table of them, the size of which is
262 * controlled by the user via the RTS flag -N.
264 * ------------------------------------------------------------------------- */
266 initCapabilities( void )
268 #if defined(THREADED_RTS)
272 // We can't support multiple CPUs if BaseReg is not a register
273 if (RtsFlags.ParFlags.nNodes > 1) {
274 errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
275 RtsFlags.ParFlags.nNodes = 1;
279 n_capabilities = RtsFlags.ParFlags.nNodes;
281 if (n_capabilities == 1) {
282 capabilities = &MainCapability;
283 // THREADED_RTS must work on builds that don't have a mutable
284 // BaseReg (eg. unregisterised), so in this case
285 // capabilities[0] must coincide with &MainCapability.
287 capabilities = stgMallocBytes(n_capabilities * sizeof(Capability),
291 for (i = 0; i < n_capabilities; i++) {
292 initCapability(&capabilities[i], i);
295 debugTrace(DEBUG_sched, "allocated %d capabilities", n_capabilities);
297 #else /* !THREADED_RTS */
300 capabilities = &MainCapability;
301 initCapability(&MainCapability, 0);
305 // There are no free capabilities to begin with. We will start
306 // a worker Task to each Capability, which will quickly put the
307 // Capability on the free list when it finds nothing to do.
308 last_free_capability = &capabilities[0];
311 /* ----------------------------------------------------------------------------
312 * setContextSwitches: cause all capabilities to context switch as
314 * ------------------------------------------------------------------------- */
316 void setContextSwitches(void)
319 for (i=0; i < n_capabilities; i++) {
320 contextSwitchCapability(&capabilities[i]);
324 /* ----------------------------------------------------------------------------
325 * Give a Capability to a Task. The task must currently be sleeping
326 * on its condition variable.
328 * Requires cap->lock (modifies cap->running_task).
330 * When migrating a Task, the migrater must take task->lock before
331 * modifying task->cap, to synchronise with the waking up Task.
332 * Additionally, the migrater should own the Capability (when
333 * migrating the run queue), or cap->lock (when migrating
334 * returning_workers).
336 * ------------------------------------------------------------------------- */
338 #if defined(THREADED_RTS)
340 giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
342 ASSERT_LOCK_HELD(&cap->lock);
343 ASSERT(task->cap == cap);
344 debugTrace(DEBUG_sched, "passing capability %d to %s %p",
345 cap->no, task->tso ? "bound task" : "worker",
347 ACQUIRE_LOCK(&task->lock);
348 task->wakeup = rtsTrue;
349 // the wakeup flag is needed because signalCondition() doesn't
350 // flag the condition if the thread is already runniing, but we want
352 signalCondition(&task->cond);
353 RELEASE_LOCK(&task->lock);
357 /* ----------------------------------------------------------------------------
358 * Function: releaseCapability(Capability*)
360 * Purpose: Letting go of a capability. Causes a
361 * 'returning worker' thread or a 'waiting worker'
362 * to wake up, in that order.
363 * ------------------------------------------------------------------------- */
365 #if defined(THREADED_RTS)
367 releaseCapability_ (Capability* cap,
368 rtsBool always_wakeup)
372 task = cap->running_task;
374 ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task);
376 cap->running_task = NULL;
378 // Check to see whether a worker thread can be given
379 // the go-ahead to return the result of an external call..
380 if (cap->returning_tasks_hd != NULL) {
381 giveCapabilityToTask(cap,cap->returning_tasks_hd);
382 // The Task pops itself from the queue (see waitForReturnCapability())
386 if (waiting_for_gc == PENDING_GC_SEQ) {
387 last_free_capability = cap; // needed?
388 debugTrace(DEBUG_sched, "GC pending, set capability %d free", cap->no);
393 // If the next thread on the run queue is a bound thread,
394 // give this Capability to the appropriate Task.
395 if (!emptyRunQueue(cap) && cap->run_queue_hd->bound) {
396 // Make sure we're not about to try to wake ourselves up
397 // ASSERT(task != cap->run_queue_hd->bound);
398 // assertion is false: in schedule() we force a yield after
399 // ThreadBlocked, but the thread may be back on the run queue
401 task = cap->run_queue_hd->bound;
402 giveCapabilityToTask(cap,task);
406 if (!cap->spare_workers) {
407 // Create a worker thread if we don't have one. If the system
408 // is interrupted, we only create a worker task if there
409 // are threads that need to be completed. If the system is
410 // shutting down, we never create a new worker.
411 if (sched_state < SCHED_SHUTTING_DOWN || !emptyRunQueue(cap)) {
412 debugTrace(DEBUG_sched,
413 "starting new worker on capability %d", cap->no);
414 startWorkerTask(cap, workerStart);
419 // If we have an unbound thread on the run queue, or if there's
420 // anything else to do, give the Capability to a worker thread.
422 !emptyRunQueue(cap) || !emptyWakeupQueue(cap) ||
423 !emptySparkPoolCap(cap) || globalWorkToDo()) {
424 if (cap->spare_workers) {
425 giveCapabilityToTask(cap,cap->spare_workers);
426 // The worker Task pops itself from the queue;
431 last_free_capability = cap;
432 debugTrace(DEBUG_sched, "freeing capability %d", cap->no);
436 releaseCapability (Capability* cap USED_IF_THREADS)
438 ACQUIRE_LOCK(&cap->lock);
439 releaseCapability_(cap, rtsFalse);
440 RELEASE_LOCK(&cap->lock);
444 releaseAndWakeupCapability (Capability* cap USED_IF_THREADS)
446 ACQUIRE_LOCK(&cap->lock);
447 releaseCapability_(cap, rtsTrue);
448 RELEASE_LOCK(&cap->lock);
452 releaseCapabilityAndQueueWorker (Capability* cap USED_IF_THREADS)
456 ACQUIRE_LOCK(&cap->lock);
458 task = cap->running_task;
460 // If the current task is a worker, save it on the spare_workers
461 // list of this Capability. A worker can mark itself as stopped,
462 // in which case it is not replaced on the spare_worker queue.
463 // This happens when the system is shutting down (see
464 // Schedule.c:workerStart()).
465 // Also, be careful to check that this task hasn't just exited
466 // Haskell to do a foreign call (task->suspended_tso).
467 if (!isBoundTask(task) && !task->stopped && !task->suspended_tso) {
468 task->next = cap->spare_workers;
469 cap->spare_workers = task;
471 // Bound tasks just float around attached to their TSOs.
473 releaseCapability_(cap,rtsFalse);
475 RELEASE_LOCK(&cap->lock);
479 /* ----------------------------------------------------------------------------
480 * waitForReturnCapability( Task *task )
482 * Purpose: when an OS thread returns from an external call,
483 * it calls waitForReturnCapability() (via Schedule.resumeThread())
484 * to wait for permission to enter the RTS & communicate the
485 * result of the external call back to the Haskell thread that
488 * ------------------------------------------------------------------------- */
490 waitForReturnCapability (Capability **pCap, Task *task)
492 #if !defined(THREADED_RTS)
494 MainCapability.running_task = task;
495 task->cap = &MainCapability;
496 *pCap = &MainCapability;
499 Capability *cap = *pCap;
502 // Try last_free_capability first
503 cap = last_free_capability;
504 if (cap->running_task) {
506 // otherwise, search for a free capability
508 for (i = 0; i < n_capabilities; i++) {
509 if (!capabilities[i].running_task) {
510 cap = &capabilities[i];
515 // Can't find a free one, use last_free_capability.
516 cap = last_free_capability;
520 // record the Capability as the one this Task is now assocated with.
524 ASSERT(task->cap == cap);
527 ACQUIRE_LOCK(&cap->lock);
529 debugTrace(DEBUG_sched, "returning; I want capability %d", cap->no);
531 if (!cap->running_task) {
532 // It's free; just grab it
533 cap->running_task = task;
534 RELEASE_LOCK(&cap->lock);
536 newReturningTask(cap,task);
537 RELEASE_LOCK(&cap->lock);
540 ACQUIRE_LOCK(&task->lock);
541 // task->lock held, cap->lock not held
542 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
544 task->wakeup = rtsFalse;
545 RELEASE_LOCK(&task->lock);
547 // now check whether we should wake up...
548 ACQUIRE_LOCK(&cap->lock);
549 if (cap->running_task == NULL) {
550 if (cap->returning_tasks_hd != task) {
551 giveCapabilityToTask(cap,cap->returning_tasks_hd);
552 RELEASE_LOCK(&cap->lock);
555 cap->running_task = task;
556 popReturningTask(cap);
557 RELEASE_LOCK(&cap->lock);
560 RELEASE_LOCK(&cap->lock);
565 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
567 debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
573 #if defined(THREADED_RTS)
574 /* ----------------------------------------------------------------------------
576 * ------------------------------------------------------------------------- */
579 yieldCapability (Capability** pCap, Task *task)
581 Capability *cap = *pCap;
583 if (waiting_for_gc == PENDING_GC_PAR) {
584 traceEventGcStart(cap);
586 traceEventGcEnd(cap);
590 debugTrace(DEBUG_sched, "giving up capability %d", cap->no);
592 // We must now release the capability and wait to be woken up
594 task->wakeup = rtsFalse;
595 releaseCapabilityAndQueueWorker(cap);
598 ACQUIRE_LOCK(&task->lock);
599 // task->lock held, cap->lock not held
600 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
602 task->wakeup = rtsFalse;
603 RELEASE_LOCK(&task->lock);
605 debugTrace(DEBUG_sched, "woken up on capability %d", cap->no);
607 ACQUIRE_LOCK(&cap->lock);
608 if (cap->running_task != NULL) {
609 debugTrace(DEBUG_sched,
610 "capability %d is owned by another task", cap->no);
611 RELEASE_LOCK(&cap->lock);
615 if (task->tso == NULL) {
616 ASSERT(cap->spare_workers != NULL);
617 // if we're not at the front of the queue, release it
618 // again. This is unlikely to happen.
619 if (cap->spare_workers != task) {
620 giveCapabilityToTask(cap,cap->spare_workers);
621 RELEASE_LOCK(&cap->lock);
624 cap->spare_workers = task->next;
627 cap->running_task = task;
628 RELEASE_LOCK(&cap->lock);
632 debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
633 ASSERT(cap->running_task == task);
637 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
642 /* ----------------------------------------------------------------------------
643 * Wake up a thread on a Capability.
645 * This is used when the current Task is running on a Capability and
646 * wishes to wake up a thread on a different Capability.
647 * ------------------------------------------------------------------------- */
650 wakeupThreadOnCapability (Capability *my_cap,
651 Capability *other_cap,
654 ACQUIRE_LOCK(&other_cap->lock);
656 // ASSUMES: cap->lock is held (asserted in wakeupThreadOnCapability)
658 ASSERT(tso->bound->cap == tso->cap);
659 tso->bound->cap = other_cap;
661 tso->cap = other_cap;
663 ASSERT(tso->bound ? tso->bound->cap == other_cap : 1);
665 if (other_cap->running_task == NULL) {
666 // nobody is running this Capability, we can add our thread
667 // directly onto the run queue and start up a Task to run it.
669 other_cap->running_task = myTask();
670 // precond for releaseCapability_() and appendToRunQueue()
672 appendToRunQueue(other_cap,tso);
674 releaseCapability_(other_cap,rtsFalse);
676 appendToWakeupQueue(my_cap,other_cap,tso);
677 other_cap->context_switch = 1;
678 // someone is running on this Capability, so it cannot be
679 // freed without first checking the wakeup queue (see
680 // releaseCapability_).
683 RELEASE_LOCK(&other_cap->lock);
686 /* ----------------------------------------------------------------------------
689 * If a Capability is currently idle, wake up a Task on it. Used to
690 * get every Capability into the GC.
691 * ------------------------------------------------------------------------- */
694 prodCapability (Capability *cap, Task *task)
696 ACQUIRE_LOCK(&cap->lock);
697 if (!cap->running_task) {
698 cap->running_task = task;
699 releaseCapability_(cap,rtsTrue);
701 RELEASE_LOCK(&cap->lock);
704 /* ----------------------------------------------------------------------------
707 * At shutdown time, we want to let everything exit as cleanly as
708 * possible. For each capability, we let its run queue drain, and
709 * allow the workers to stop.
711 * This function should be called when interrupted and
712 * shutting_down_scheduler = rtsTrue, thus any worker that wakes up
713 * will exit the scheduler and call taskStop(), and any bound thread
714 * that wakes up will return to its caller. Runnable threads are
717 * ------------------------------------------------------------------------- */
720 shutdownCapability (Capability *cap, Task *task, rtsBool safe)
726 // Loop indefinitely until all the workers have exited and there
727 // are no Haskell threads left. We used to bail out after 50
728 // iterations of this loop, but that occasionally left a worker
729 // running which caused problems later (the closeMutex() below
730 // isn't safe, for one thing).
732 for (i = 0; /* i < 50 */; i++) {
733 ASSERT(sched_state == SCHED_SHUTTING_DOWN);
735 debugTrace(DEBUG_sched,
736 "shutting down capability %d, attempt %d", cap->no, i);
737 ACQUIRE_LOCK(&cap->lock);
738 if (cap->running_task) {
739 RELEASE_LOCK(&cap->lock);
740 debugTrace(DEBUG_sched, "not owner, yielding");
744 cap->running_task = task;
746 if (cap->spare_workers) {
747 // Look for workers that have died without removing
748 // themselves from the list; this could happen if the OS
749 // summarily killed the thread, for example. This
750 // actually happens on Windows when the system is
751 // terminating the program, and the RTS is running in a
755 for (t = cap->spare_workers; t != NULL; t = t->next) {
756 if (!osThreadIsAlive(t->id)) {
757 debugTrace(DEBUG_sched,
758 "worker thread %p has died unexpectedly", (void *)t->id);
760 cap->spare_workers = t->next;
762 prev->next = t->next;
769 if (!emptyRunQueue(cap) || cap->spare_workers) {
770 debugTrace(DEBUG_sched,
771 "runnable threads or workers still alive, yielding");
772 releaseCapability_(cap,rtsFalse); // this will wake up a worker
773 RELEASE_LOCK(&cap->lock);
778 // If "safe", then busy-wait for any threads currently doing
779 // foreign calls. If we're about to unload this DLL, for
780 // example, we need to be sure that there are no OS threads
781 // that will try to return to code that has been unloaded.
782 // We can be a bit more relaxed when this is a standalone
783 // program that is about to terminate, and let safe=false.
784 if (cap->suspended_ccalling_tasks && safe) {
785 debugTrace(DEBUG_sched,
786 "thread(s) are involved in foreign calls, yielding");
787 cap->running_task = NULL;
788 RELEASE_LOCK(&cap->lock);
793 traceEventShutdown(cap);
794 RELEASE_LOCK(&cap->lock);
797 // we now have the Capability, its run queue and spare workers
798 // list are both empty.
800 // ToDo: we can't drop this mutex, because there might still be
801 // threads performing foreign calls that will eventually try to
802 // return via resumeThread() and attempt to grab cap->lock.
803 // closeMutex(&cap->lock);
806 /* ----------------------------------------------------------------------------
809 * Attempt to gain control of a Capability if it is free.
811 * ------------------------------------------------------------------------- */
814 tryGrabCapability (Capability *cap, Task *task)
816 if (cap->running_task != NULL) return rtsFalse;
817 ACQUIRE_LOCK(&cap->lock);
818 if (cap->running_task != NULL) {
819 RELEASE_LOCK(&cap->lock);
823 cap->running_task = task;
824 RELEASE_LOCK(&cap->lock);
829 #endif /* THREADED_RTS */
832 freeCapability (Capability *cap)
834 stgFree(cap->mut_lists);
835 stgFree(cap->saved_mut_lists);
836 #if defined(THREADED_RTS)
837 freeSparkPool(cap->sparks);
842 freeCapabilities (void)
844 #if defined(THREADED_RTS)
846 for (i=0; i < n_capabilities; i++) {
847 freeCapability(&capabilities[i]);
850 freeCapability(&MainCapability);
854 /* ---------------------------------------------------------------------------
855 Mark everything directly reachable from the Capabilities. When
856 using multiple GC threads, each GC thread marks all Capabilities
857 for which (c `mod` n == 0), for Capability c and thread n.
858 ------------------------------------------------------------------------ */
861 markSomeCapabilities (evac_fn evac, void *user, nat i0, nat delta,
862 rtsBool prune_sparks USED_IF_THREADS)
868 // Each GC thread is responsible for following roots from the
869 // Capability of the same number. There will usually be the same
870 // or fewer Capabilities as GC threads, but just in case there
871 // are more, we mark every Capability whose number is the GC
872 // thread's index plus a multiple of the number of GC threads.
873 for (i = i0; i < n_capabilities; i += delta) {
874 cap = &capabilities[i];
875 evac(user, (StgClosure **)(void *)&cap->run_queue_hd);
876 evac(user, (StgClosure **)(void *)&cap->run_queue_tl);
877 #if defined(THREADED_RTS)
878 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_hd);
879 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_tl);
881 for (task = cap->suspended_ccalling_tasks; task != NULL;
883 evac(user, (StgClosure **)(void *)&task->suspended_tso);
886 #if defined(THREADED_RTS)
888 pruneSparkQueue (evac, user, cap);
890 traverseSparkQueue (evac, user, cap);
895 #if !defined(THREADED_RTS)
896 evac(user, (StgClosure **)(void *)&blocked_queue_hd);
897 evac(user, (StgClosure **)(void *)&blocked_queue_tl);
898 evac(user, (StgClosure **)(void *)&sleeping_queue);
903 markCapabilities (evac_fn evac, void *user)
905 markSomeCapabilities(evac, user, 0, 1, rtsFalse);