Skip to content

Commit dcfbf23

Browse files
author
Aidan Lee
committed
Add emscripten throw back
1 parent dc1c698 commit dcfbf23

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/hx/thread/ThreadImpl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ namespace
6161

6262
hx::thread::Thread hx::thread::Thread_obj::create(Callable<void(void)> job)
6363
{
64+
#ifdef EMSCRIPTEN
65+
return hx::Throw(HX_CSTRING("Threads are not supported on Emscripten"));
66+
#else
67+
6468
auto semaphore = new hx::thread::CountingSemaphore_obj(0);
6569
auto obj = new ThreadImpl_obj(nextThreadnumber++);
6670
auto native = new ThreadImpl_obj::Native(new std::thread(run, obj, job, semaphore));
@@ -73,6 +77,7 @@ hx::thread::Thread hx::thread::Thread_obj::create(Callable<void(void)> job)
7377
semaphore->acquire();
7478

7579
return hx::thread::Thread{ obj };
80+
#endif
7681
}
7782

7883
String hx::thread::ThreadImpl_obj::toString()

0 commit comments

Comments
 (0)