Closed Bug 1260432 Opened 8 years ago Closed 8 years ago

Atomics.pause()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

This is an experimental API proposed in https://github.com/tc39/ecmascript_sharedmem/issues/87 as a replacement for part of the functionality that disappeared when the synchronic proposal was canned.  See that bug for some thoughts about how this API would be used.

In brief:

Atomics.pause = function(n) {
  count = ToInt32(n)
  if (count < 0)
    return false;
  if (count <= cutoff)
    wait();
  return count < cutoff;
}

where the meaning of cutoff and wait are platform-dependent, see the referenced bug for some empirical data about what works.  The intent is that wait() waits a very short time in an efficient way.
Attached patch implement Atomics.pause (obsolete) — Splinter Review
Proof of concept with Mac OS X support
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Proof of concept with Mac OS X support
Attachment #8735858 - Attachment is obsolete: true
Further elaboration:  in the abstract algorithm, wait() actually takes count as an argument.  The meaning of count is that it will be assumed to be an iteration number in a loop external to pause(), normally starting at 0 and increasing through successive iterations of that outer loop.  The meaning of wait may depend on the value of count, for example, the higher count is, the longer the wait may be.

It is legal for Atomics.pause() always to return false and never wait, the pseudocode does not express that well either.

The intent is that Atomics.pause() should not have any observable internal state, in the sense that waiting in one part of the code should not affect waiting in another part of the code, but given that the wait() subroutine has system-dependent meaning it may be hard to specify + enforce that in practice.  So at most that is a NOTE.
See Also: → 1268793
This is not in the current spec and needs much more experimentation before it becomes interesting.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: