On 9/19/19 7:46 PM, Mario Gliewe wrote:
Hi again,
I found another step stone to stumble over :)
In the JSRuntime there is this job_list, one has to take care on the
context's eventloop (via JS_ExecutePendingJob()) ; so don't terminate
the loop until all jobs are done.
As far as I could see, this is only used to fulfill/reject Promises..
While this concept seems reasonable (afaik that's what the node.js
setImmediate() would do), I was wondering why the Timers in quickjs-libc
wouldn't use this mechanism?
And I was wondering why this list is bound to the JSRuntime rather to
the JSContext?
The reason I stumbled over this, was again the Worker-Interface, because
I cannot use the same runtime for different contexts in seperate threads
with this approach.
Even if I guarantee to never use the same JSValues across different
threads and synchronize gc(), the pending jobs would be executed in the
main-thread anyway.