X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FCapability.c;h=bd6d56ff006ba7f72fd588865b6f41520770e22e;hb=f8f4cb3f3a46e0495917a927cefe906531b7b38e;hp=a81d71073a20877d6cc1259cedcc4232706cfb10;hpb=6a405b1efd138a4af4ed93ce4ff173a4c5704512;p=ghc-hetmet.git diff --git a/rts/Capability.c b/rts/Capability.c index a81d710..bd6d56f 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -294,10 +294,10 @@ initCapabilities( void ) void setContextSwitches(void) { - nat i; - for (i=0; i < n_capabilities; i++) { - capabilities[i].context_switch = 1; - } + nat i; + for (i=0; i < n_capabilities; i++) { + contextSwitchCapability(&capabilities[i]); + } } /* ---------------------------------------------------------------------------- @@ -482,14 +482,17 @@ waitForReturnCapability (Capability **pCap, Task *task) if (!cap->running_task) { nat i; // otherwise, search for a free capability + cap = NULL; for (i = 0; i < n_capabilities; i++) { - cap = &capabilities[i]; - if (!cap->running_task) { + if (!capabilities[i].running_task) { + cap = &capabilities[i]; break; } } - // Can't find a free one, use last_free_capability. - cap = last_free_capability; + if (cap == NULL) { + // Can't find a free one, use last_free_capability. + cap = last_free_capability; + } } // record the Capability as the one this Task is now assocated with.