Changes between Version 27 and Version 28 of LightweightConcurrency


Ignore:
Timestamp:
May 17, 2012 11:36:10 PM (2 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v27 v28  
    8585                   SContSwitched SContSwitchReason 
    8686data SContSwitchReason = Yielded |          -- SCont has yielded, but runnable 
    87                          BlockedInHaskell | -- SCont is blocked on a user-level concurrent data structure  
     87                         BlockedInHaskell | -- SCont is blocked on a user-level concurrent data structure (MVars and such) 
    8888                         BlockedInRTS |     -- SCont is blocked on a foreign call, blackhole, etc,. 
    8989                         Completed          -- SCont has run to completion 
     
    9393}}} 
    9494 
    95 Primitive `setSContSwitchReason` updates the status of current SCont. Notice that this prevents the programmer from modifying the status of other SConts and is a PTM action. Thus, the effect of updating the status takes place when the transaction commits and the control has switches to another SCont. This avoids any race conditions that might be involved in reading the status of an SCont before it has completed switch operation.  
     95Any attempt to switch to an SCont with status other than `SContSwitched Yielded` throws an exception. Primitive `setSContSwitchReason` updates the status of current SCont. This prevents the programmer from modifying the status of other SConts. 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.  
     96 
     97Before a switch operation, we expect the programmer to indicate the reason for switching through setScontSwitchReason. Exception is raised by the switch primitives if switch reason has not been provided. When a switched SCont resumes execution, its status is automatically updated to `SContRunning`.  
    9698 
    9799=== Capabilities and Tasks ===