[whatwg] Terminate a Worker algorithm
ap at webkit.org
Mon Dec 15 22:55:57 PST 2008
Dec 16, 2008, в 9:43 AM, Ian Hickson написал(а):
>> 1) The algorithm assumes that a WorkerGlobalScope exists, and doesn't
>> specify what happens if it is invoked before WorkerGlobalScope is
>> created (e.g. if the script is still being loaded, or the scope is
>> created, but Worker.terminate() is called from JS). I think that the
>> right behavior is to re-invoke the algorithm after the scope is
>> because it may be too late to prevent its creation.
> It can't be invoked before the WorkerGlobalScope is created. The
> WorkerGlobalScope is created before the constructor returns the Worker
This means that creating a Worker would involve running a nested run
loop, waiting for WorkerGlobalScope to be created in another thread/
process. I think that WorkerGlobalScope needs to be created
asynchronously. The above is the only observable difference with
synchronous creation that I could find, so I think that requiring
synchronous operation is unnecessary.
>> 2) Events in WorkerGlobalScope event queue are dropped when
>> terminating a
>> worker, but messages posted to Worker are not. I think that the
>> behavior is that after calling Worker.terminate(), no messages will
>> dispatched to worker's event listeners.
> Once 'closing' is set to true, the queue discards any additional
There is no "closing" flag on the Worker object, it's only defined on
WorkerGlobalScope as far as I can see.
- WBR, Alexey Proskuryakov
More information about the whatwg