Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cpp runtime: Remove pthread dependency. (#4086)
ANTLR doesn't use threads, and it used not to depend on pthread library either. It changed recently in 2022: #3708 The patch linked against pthread, because the GNU libstdc++ used to depend on it in their implementation of `std::call_once`. By the way, the libstdc++ stopped it in 2020: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=93e79ed391b9c636f087e6eb7e70f14963cd10ad So this is not more needed. I would like to stop depending on pthread. I am using ANTLR in C++ WebAssembly for the website: https://arthursonzogni.com/Diagon/ It doesn't compile with emscripten anymore, because by default pthread is not enabled. It could be enabled, but it would force me to deploy cross-origin-isolation: https://web.dev/cross-origin-isolation-guide/ Solutions: 1. Stop linking against pthread, because the libstdc++ stopped depending on it for std::call_once. 2. Implement std::call_once ourself using std::atomic_flag 3. Implement std::call_once ourself using a boolean flag, assuming we don't need to support threads. I chose to do (2) in this patch. Signed-off-by: ArthurSonzogni <sonzogniarthur@gmail.com>
- Loading branch information