[quickjs-devel] Re: threadsafity and workers..
- From: Charlie Gordon <quickjs@xxxxxxxxxxx>
- To: quickjs-devel@xxxxxxxxxxxxx
- Date: Tue, 13 Aug 2019 18:01:43 +0200
On 13 Aug 2019, at 17:24, Mario Gliewe <mag@xxxxxxxxx> wrote:
hi,
Hi Mario
are there any predictions as much the js runtime/context is threadsafe?
QuickJS does not support multi-threading at the moment, but it should be safe
to use if all calls to the API for any given JSRuntime
are made from the same thread.
The stack overflow detection system currently prevents proper operation for
calls made from different threads, even sequentially without concurrent access
to the same JSRuntime or JSContext objects. An upcoming update should fix this,
but concurrent access to QuickJS objects seems more difficult to solve.
would it be feasible to create a Worker by just instantiate a new
context in a new thread and let them interact via pipes (or whatever ipc)?
Just instantiating a new context is not sufficient if there are concurrent
accesses to the same JSRuntime.
We are investigating some simple alternatives for QuickJS to support proper
operation in multi-threaded systems using messages or pipes.
Best regards
Chqrlie.
Other related posts: