• Yedidya Feldblum's avatar
    Use relaxed_atomic in IOThreadPoolExecutor · 64fd47a2
    Yedidya Feldblum authored
    Summary:
    [Folly] Use `relaxed_atomic` in `IOThreadPoolExecutor`.
    
    For the `nextThread_` field, which may be mutated within `pickThread` in any number of threads concurrently. While `pickThread` is only ever called with a shared lock held, the shared lock does not actually help with concurrent mutations.
    
    Since the mutations of `nextThread_` by `pickThread` is always a `std::atomic::fetch_add` with `std::memory_order_relaxed`, and since that case is a bit more nicely solved with `folly::relaxed_atomic`, switch to that.
    
    Reviewed By: ot
    
    Differential Revision: D6290451
    
    fbshipit-source-id: e473fa6321e462c9b3df9d2bd9650967cca3444a
    64fd47a2
IOThreadPoolExecutor.h 3.94 KB