Changes between Version 96 and Version 97 of LightweightConcurrency
- Timestamp:
- 05/22/12 17:54:02 (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
LightweightConcurrency
v96 v97 67 67 writePVar :: PVar a -> a -> PTM () 68 68 atomically :: PTM a -> IO a 69 }}} 70 71 A PTM transaction may allocate, read and write transactional variables of type `PVar a`. It is important to notice that PTM does not provide a blocking `retry` mechanism. Such a blocking action needs to interact with the scheduler, to block the current thread and resume another thread. We will see [#AbstractSchedulerInterface later] how to allow such interactions while not imposing any restriction on the structure of the schedulers. 69 retry :: PTM a 70 }}} 71 72 A PTM transaction may allocate, read and write transactional variables of type `PVar a`. It is important to notice that PTM does provide a blocking `retry` mechanism which needs to interact with the scheduler, to block the current thread and resume another thread. We will see [#PTMretry later] how we allow such interactions while not imposing any restriction on the structure of the schedulers. 72 73 73 74 === One-shot Continuations === … … 387 388 === PTM retry === 388 389 389 GHC's STM module provides a 390 GHC's STM module provides a `retry` primitive, which blocks the thread invoking retry to block until one of the TVars it has read has been written to. After a thread blocks on the STM, the next available thread from the capability's run queue is resumed. Eventually, the blocked thread is added back to the run queue when one of the TVars in its read set has been written to. 391 392 In the LWC implementation, while waiting on a PVar is still an RTS mechanism, interaction with the scheduler is implemented using the scheduler actions. After blocking the thread on the PTM, RTS executes the thread's yieldControlAction to resume the scheduler. When the thread is eventually unblocked, its scheduleSContAction is executed to put the thread back into its user-level scheduler data structure. 390 393 391 394 === Black-hole Handling ===
