Re: [w3ctag/design-reviews] SharedArrayBuffer + Atomics (#165)

@lars-t-hansen (hm, this doesn't seem to be working).

Sorry, I didn't notice this thread until now.

Deadlocks are possible to write, but there are provisions in the spec to disallow calls to `Atomics.wait` in certain contexts, the only call that can block. Currently, `Atomics.wait` is only allowed in DedicatedWorkers and SharedWorkers (see https://github.com/whatwg/html/pull/2521). As a result, this shouldn't hang the tab, and manifest as just a bug in the page (e.g. the page is waiting for the worker to complete, so perhaps some operation is pending, but the page will not be hung). The result would be similar to writing `while (true) {}` in a worker, with the difference being that `Atomics.wait` is not actually a spin loop.

As for detecting deadlocks, I'm not certain any of the implementations do this, or if it is even possible given the low-level nature of the wake/wait mechanism. You could easily determine that there are two workers are waiting via `Atomics.wait`, but I don't know if you could tell that they were related.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/165#issuecomment-300299417

Received on Tuesday, 9 May 2017 20:59:27 UTC