Changes between Version 118 and Version 119 of LightweightConcurrency


Ignore:
Timestamp:
May 30, 2012 7:25:58 PM (23 months ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v118 v119  
    9797Any attempt to switch to an SCont with status other than `SContSwitched Yielded` throws an exception. Primitive `setSContSwitchReason` updates the status of SCont. Since setSContSwitchReason is a PTM action, the effect of updating the status takes place when the transaction commits and the control has switched to another SCont. This avoids any race conditions that might be involved in reading the status of an SCont before it has switched.  
    9898 
    99 Before a switch operation, we expect the programmer to indicate the reason for switching through setScontSwitchReason. Exception is raised by the switch primitives if a switch reason has not been provided. When a switched SCont resumes execution, its status is automatically updated to `SContRunning`.  
     99Before a switch operation, we expect the programmer to indicate the reason for switching through setScontSwitchReason. Exception is raised by the switch primitives if a switch reason has not been provided. When a switched SCont resumes execution, its status is automatically updated to `SContRunning`. 
     100 
     101=== SCont-Local Storage === 
     102 
     103SCont-local storage (SLS) provides a solution for associating arbitrary state with an SCont. Each SCont has a single slot with type [http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Dynamic.html Dynamic]. SLS interface is give below: 
     104 
     105{{{ 
     106setSLS :: SCont -> Dynamic -> IO () 
     107getSLS :: SCont -> PTM Dynamic 
     108}}} 
     109 
     110`Data.Dynamic` provides a way for safely casting between any arbitrary data type and `Dynamic` type. This allows SLS to be generic as well as type-safe. 
    100111 
    101112== Abstracting the Scheduler ==