Re: [css-houdini-drafts] [worklets] relationship to JavaScript agent clusters

Quoth @domenic:

> So it seems like we are still not settled on whether worklets can share memory with the main thread. @padenot thinks they should be able to. @hoch would like to discuss in the WG. I think that is where we are now.

I had a discussion with @padenot about this last night and my take on it - so far - is that worklets cannot be in the same agent cluster as the main thread because their lifetimes are insufficiently coordinated.  Specifically, my understanding is that the worklet thread is simply destroyed if the document in the main thread, and its worker threads, are pushed into the window history.  When that document and its workers are subsequently re-activated, they may be left hanging forever waiting for something (an update to shared memory) that will never come from the worklet, because the worklet no longer exists.

On the other hand: if there is some kind of reliable and predictable infrastructure around that (eg, the main document can listen for some event that said it was deactivated and reactivated, and the liveness of the worklet can be inferred reliably from that event) then my concern in the previous paragraph may not matter.  All I care about is that it should be possible to write reliable threaded code, and for that to happen, programs must *know* whether threads are shut down by the embedding.  (But I don't know enough about the details to the web stack and worklets to make a call on that.)


-- 
GitHub Notification of comment by lars-t-hansen
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/380#issuecomment-295144556 using your GitHub account

Received on Wednesday, 19 April 2017 07:45:47 UTC