Return true if the work was successfully enqueued and false otherwise. Refer to the corresponding C API documentation.
| 256 | // Return true if the work was successfully enqueued and false otherwise. |
| 257 | // Refer to the corresponding C API documentation. |
| 258 | bool proxyAsync(pthread_t target, std::function<void()>&& func) { |
| 259 | std::function<void()>* arg = new std::function<void()>(std::move(func)); |
| 260 | if (!emscripten_proxy_async(queue, target, runAndFree, (void*)arg)) { |
| 261 | delete arg; |
| 262 | return false; |
| 263 | } |
| 264 | return true; |
| 265 | } |
| 266 | |
| 267 | bool proxySync(const pthread_t target, const std::function<void()>& func) { |
| 268 | return emscripten_proxy_sync(queue, target, run, (void*)&func); |