Changes between Version 70 and Version 71 of LightweightConcurrency


Ignore:
Timestamp:
May 21, 2012 4:53:56 PM (3 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v70 v71  
    293293}}} 
    294294 
    295 primitive that blocks the current capability until one of the PVars that it has read from has been updated. Thus, the complete implementation of yieldControlAction example introduced [#AbstractingtheScheduler earlier] is given below. 
    296  
    297  
     295primitive that aborts the current transaction and blocks the current capability. The capability is implicitly woken up when one of the PVars that it has read from has been updated. Then, the original transaction is re-executed. One of the PVars read under yieldControlAction will be the scheduler data structure. Hence, the capability is woken up when the scheduler data structure is updated. The complete implementation of yieldControlAction example introduced [#AbstractingtheScheduler earlier] is given below. 
     296 
     297{{{ 
     298yieldControlAction :: PTM ()  
     299yieldControlAction = do 
     300  sched :: PVar [SCont] <- -- get sched  
     301  contents :: [SCont] <- readPVar sched  
     302  case contents of 
     303    x:tail -> do {  
     304      writePVar $ contents tail;  
     305      switchTo x -- DOES NOT RETURN 
     306    }  
     307    otherwise -> sleepCapability 
     308}}} 
    298309 
    299310=== SCont Affinity ===