Skip to content
  • Edward Z. Yang's avatar
    Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4 · 83d563cb
    Edward Z. Yang authored
    This is patch that adds support for interruptible FFI calls in the form
    of a new foreign import keyword 'interruptible', which can be used
    instead of 'safe' or 'unsafe'.  Interruptible FFI calls act like safe
    FFI calls, except that the worker thread they run on may be interrupted.
    
    Internally, it replaces BlockedOnCCall_NoUnblockEx with
    BlockedOnCCall_Interruptible, and changes the behavior of the RTS
    to not modify the TSO_ flags on the event of an FFI call from
    a thread that was interruptible.  It also modifies the bytecode
    format for foreign call, adding an extra Word16 to indicate
    interruptibility.
    
    The semantics of interruption vary from platform to platform, but the
    intent is that any blocking system calls are aborted with an error code.
    This is most useful for making function calls to system library
    functions that support interrupting.  There is no support for pre-Vista
    Windows.
    
    There is a partner testsuite patch which adds several tests for this
    functionality.
    83d563cb