... | ... | @@ -35,7 +35,7 @@ Lightweight concurrency implementation resides in the `ghc-lwc` branch in the gi |
|
|
- [Unreachable Concurrent Datastructure](lightweight-concurrency#unreachable-concurrent-datastructure)
|
|
|
- [Unreachable Scheduler](lightweight-concurrency#unreachable-scheduler)
|
|
|
- [Preemptive Scheduling](lightweight-concurrency#preemptive-scheduling)
|
|
|
- [SafeForeign Calls](lightweight-concurrency#safe-foreign-calls)
|
|
|
- [Safe Foreign Calls](lightweight-concurrency#safe-foreign-calls)
|
|
|
- [PTM retry](lightweight-concurrency#ptm-retry)
|
|
|
- [Black-hole Handling](lightweight-concurrency#)
|
|
|
- [Asynchronous Exceptions](lightweight-concurrency#asynchronous-exceptions)
|
... | ... | @@ -421,10 +421,13 @@ setFinalizer :: SCont -> IO () -> IO() |
|
|
```
|
|
|
|
|
|
|
|
|
If an SCont is blocked with status `SContSwitched Yielded` has become unreachable, we run the SCont's finalizer, if installed.
|
|
|
For the given thread, `setFinalizer` installs the given IO () as the finalizer. If an SCont is blocked with status `SContSwitched Yielded` has become unreachable, we run the SCont's finalizer, if installed.
|
|
|
|
|
|
### Preemptive Scheduling
|
|
|
|
|
|
|
|
|
GHC's concurrency library supports preemptive scheduling of threads. In the LWC implementation, we utilize the scheduler actions to preempt the thread; on a timer interrupt, we execute the current thread's schedulerSContAction followed by yieldControlAction. This is similar to the implementation of the `yield` primitive described [earlier](lightweight-concurrency#schedulers).
|
|
|
|
|
|
### Safe Foreign Calls
|
|
|
|
|
|
|
... | ... | @@ -442,6 +445,9 @@ The fast path in the LWC implementation is the same as vanilla implementation. H |
|
|
|
|
|
### PTM retry
|
|
|
|
|
|
|
|
|
GHC's STM module provides a
|
|
|
|
|
|
### Black-hole Handling
|
|
|
|
|
|
### Asynchronous Exceptions
|
... | ... | |