Skip to content
  • Simon Marlow's avatar
    Split part of the Task struct into a separate struct InCall · 7effbbbb
    Simon Marlow authored
    The idea is that this leaves Tasks and OSThread in one-to-one
    correspondence.  The part of a Task that represents a call into
    Haskell from C is split into a separate struct InCall, pointed to by
    the Task and the TSO bound to it.  A given OSThread/Task thus always
    uses the same mutex and condition variable, rather than getting a new
    one for each callback.  Conceptually it is simpler, although there are
    more types and indirections in a few places now.
    
    This improves callback performance by removing some of the locks that
    we had to take when making in-calls.  Now we also keep the current Task
    in a thread-local variable if supported by the OS and gcc (currently
    only Linux).
    7effbbbb