• Simon Marlow's avatar
    Don't move Capabilities in setNumCapabilities (#8209) · aa779e09
    Simon Marlow authored
    We have various problems with reallocating the array of Capabilities,
    due to threads in waitForReturnCapability that are already holding a
    pointer to a Capability.
    Rather than add more locking to make this safer, I decided it would be
    easier to ensure that we never move the Capabilities at all.  The
    capabilities array is now an array of pointers to Capabaility.  There
    are extra indirections, but it rarely matters - we don't often access
    Capabilities via the array, normally we already have a pointer to
    one.  I ran the parallel benchmarks and didn't see any difference.
Threads.c 25.7 KB