• parcs's avatar
    UniqSupply: make mkSplitUniqSupply thread-safe · 036910ad
    parcs authored
    unsafeInterleaveIO is used instead of unsafeDupableInterleaveIO because
    a mk_supply thunk that is simultaneously entered by two threads should
    evaluate to the same UniqSupply.
    
    The UniqSupply counter is now incremented atomically using the RTS's
    atomic_inc().
    
    To mitigate the extra overhead of unsafeInterleaveIO in the
    single-threaded compiler, noDuplicate# is changed to exit early when
    n_capabilities == 1.
    036910ad
UniqSupply.lhs 7.37 KB