quickjspp
quickjspp copied to clipboard
Does QuickJS support multithreading?
I have a function written in JavaScript. I have created a callback in C++ as following:
void callbackFunction( int val ) {
try {
auto cb = (std::function<void(int val)>) context.eval("run");
cb(val);
}
catch {
...
}
}
I want to put callbackFunction() on a thread, std::thread(callbackFunction, val).detach(). But this always end up with terminate called after throwing an instance of 'qjs::exception'
How can I use multithreading in quickjs? Is there any workaround?