Changes between Version 115 and Version 116 of LightweightConcurrency


Ignore:
Timestamp:
May 30, 2012 3:26:12 PM (23 months ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v115 v116  
    106106------ Schedule SCont Action :: SCont -> PTM () ------ 
    107107 
    108 getScheduleSContAction :: SCont -> PTM (SCont -> PTM ()) 
     108getScheduleSContAction :: PTM (SCont -> PTM ()) 
    109109setScheduleSContAction :: SCont -> (SCont -> PTM ()) -> PTM () 
    110110 
    111111----------- Yield Control Action :: PTM () ----------- 
    112112 
    113 getYieldControlAction :: SCont -> PTM (PTM ()) 
     113getYieldControlAction :: PTM (PTM ()) 
    114114setYieldControlAction :: SCont -> PTM () -> PTM () 
    115115}}} 
    116116 
    117 Abstractly, given an SCont, the scheduleSContAction appends the SCont to a scheduler. The yieldControlAction picks an SCont from a scheduler and switches to it. In order to make the ideas more concrete, let us assume that we have a very simple round-robin scheduler, implemented as a `PVar[SCont]`. One possible implementation of scheduler actions for this scheduler is given below. 
     117Abstractly, given an SCont, the scheduleSContAction appends the SCont to a scheduler. The yieldControlAction picks an SCont from a scheduler and switches to it. The `get*` functions will fetch the scheduler actions of the current SCont. In order to make the ideas more concrete, let us assume that we have a very simple round-robin scheduler, implemented as a `PVar[SCont]`. One possible implementation of scheduler actions for this scheduler is given below. 
    118118 
    119119{{{ 
     
    166166  enque 
    167167  -- Switch to next SCont from scheduler 
    168   switchToNext :: PTM () <- getYCA s 
     168  switchToNext :: PTM () <- getYCA 
    169169  switchToNext 
    170170}}} 
     
    179179    sc <- getCurrentSCont; 
    180180    setSContSwitchReason sc Completed; 
    181     switchToNext <- getYCA sc; 
     181    switchToNext <- getYCA; 
    182182    switchToNext 
    183183  } 
    184184  ns <- newSCont (f >> epilogue)   
    185185  atomically $ do { 
    186     s <- getCurrentSCont; 
    187186    -- Initialize scheduler actions 
    188     ssa <- getSSA s; 
     187    ssa <- getSSA; 
    189188    setSSA ns ssa; 
    190     yca <- getYCA s; 
     189    yca <- getYCA; 
    191190    setYCA ns yca; 
    192191    -- Append the new SCont to current SCont's scheduler 
     
    223222        writePVar ref $ v 
    224223          where v = Empty $ ts++[(hole, wakeup)]  
    225         switchToNext <- getYCA s  
     224        switchToNext <- getYCA 
    226225        switchToNext 
    227226      Full x ((x', wakeup):ts) -> do  
     
    259258initialTask = atomically $ do 
    260259  s <- getCurrentSCont 
    261   yca <- getYCA s 
     260  yca <- getYCA 
    262261  setSContSwitchReason s Completed 
    263262  yca