Open
Description
openedon Apr 13, 2021
Various operations within locale code use _LOCK_LOCALE to take a global lock. Because most basic_ostream methods hit this locale code (e.g. via use_facet), this means that most basic_ostream operations also end up taking a global lock.
The net effect of this as we discovered in our heavily multithreaded code base is that basic_ostream is completely non performant. It doesn't matter if you carefully manage your output streams (e.g. one per thread), you end up hitting contention on this global lock across all threads.
Is there a solution to this other than avoiding basic_ostream in multi threaded code?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment