| 64 | } |
| 65 | |
| 66 | hx::thread::Thread hx::thread::Thread_obj::create(CreateFunction job) |
| 67 | { |
| 68 | #ifdef EMSCRIPTEN |
| 69 | return hx::Throw(HX_CSTRING("Threads are not supported on Emscripten")); |
| 70 | #else |
| 71 | |
| 72 | auto semaphore = new hx::thread::CountingSemaphore_obj(0); |
| 73 | auto obj = new ThreadImpl_obj(nextThreadnumber++, job, semaphore); |
| 74 | |
| 75 | hx::GCSetFinalizer(obj, ThreadImpl_obj::finalise); |
| 76 | hx::GCPrepareMultiThreaded(); |
| 77 | |
| 78 | semaphore->acquire(); |
| 79 | |
| 80 | return hx::thread::Thread{ obj }; |
| 81 | #endif |
| 82 | } |
| 83 | |
| 84 | String hx::thread::ThreadImpl_obj::toString() |
| 85 | { |
nothing calls this directly
no test coverage detected