From 771b0d3ffbc7b034b436d4ad27be7d0a1da6b3cd Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 24 Feb 2020 10:55:31 -0800 Subject: compilers/mixins/emscripten: Implement thread support Emscripten has pthread support (as well as C++ threads), but we don't currently implement them. This fixes that by adding the necessary code. The one thing I'm not sure about is setting the pool size. The docs suggest that you really want to do this to ensure that your code works correctly, but the number should really be configurable, not sure how to set that. Fixes #6684 --- test cases/wasm/2 threads/threads.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test cases/wasm/2 threads/threads.cpp (limited to 'test cases/wasm/2 threads/threads.cpp') diff --git a/test cases/wasm/2 threads/threads.cpp b/test cases/wasm/2 threads/threads.cpp new file mode 100644 index 000000000..1caa73da3 --- /dev/null +++ b/test cases/wasm/2 threads/threads.cpp @@ -0,0 +1,13 @@ +#include +#include +#include + +int main(void) { + std::cout << "Before thread" << std::endl; + std::thread t([]() { + sleep(1); + std::cout << "In a thread." << std::endl; + }); + t.join(); + std::cout << "After thread" << std::endl; +} -- cgit v1.2.3