quickjspp icon indicating copy to clipboard operation
quickjspp copied to clipboard

Does QuickJS support multithreading?

Open ShubhamPatil007 opened this issue 3 years ago • 0 comments

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?

ShubhamPatil007 avatar Apr 26 '22 08:04 ShubhamPatil007