Changes between Version 1 and Version 2 of Commentary/Rts/Signals


Ignore:
Timestamp:
Dec 7, 2006 10:03:08 AM (8 years ago)
Author:
simonmar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/Signals

    v1 v2  
    5757When the runtime is idle, the OS threads will all be waiting inside `yieldCapability()`, waiting for some work to arrive.  We want a signal to be able to create a new Haskell thread and wake up one of these OS threads to run it, but unfortunately the range of operations that can be performed inside a POSIX signal handler is extremely limited, and doesn't include any inter-thread synchronisation (because the signal handler might be running on the same stack as the OS thread it is communicating with). 
    5858 
    59 The solution we use, on both Windows and POSIX systems, is to pass all signals that arrive to the [wiki:Commentary/Rts/IOManager IO Manager] thread.  On POSIX this works by sending the signal number down a pipe, on Windows it works by storing the signal number in a buffer and signaling the IO Manager's `Event` object to wake it up.  The IO Manager thread then wakes up and creates a new thread for the signal handler(s), before going back to sleep again. 
     59The solution we use, on both Windows and POSIX systems, is to pass all signals that arrive to the [wiki:Commentary/Rts/IOManager IO Manager] thread.  On POSIX this works by sending the signal number down a pipe, on Windows it works by storing the signal number in a buffer and signaling the IO Manager's `Event` object to wake it up.  The IO Manager thread then wakes up and creates a new thread for the signal handler, before going back to sleep again.