MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fx_Atomics_wait

Function fx_Atomics_wait

xs/sources/xsAtomics.c:544–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544void fx_Atomics_wait(txMachine* the)
545{
546 mxAtomicsDeclarations(1, 1, 0);
547 txNumber timeout;
548 txInteger result;
549 fxPushAtomicsValue(the, 2, dispatch->value.typedArray.dispatch->constructorID);
550 timeout = (mxArgc > 3) ? fxToNumber(the, mxArgv(3)) : C_NAN;
551 if (c_isnan(timeout))
552 timeout = C_INFINITY;
553 else if (timeout < 0)
554 timeout = 0;
555 result = (*dispatch->value.typedArray.atomics->wait)(the, host, offset, the->stack, timeout);
556 if (result < 0)
557 mxPushStringX("not-equal");
558 else {
559 result = fxWaitSharedChunk(the, (txByte*)host->value.host.data + offset, timeout, C_NULL);
560 if (result == 0)
561 mxPushStringX("timed-out");
562 else
563 mxPushStringX("ok");
564 }
565 mxPullSlot(mxResult);
566}
567
568#if mxECMAScript2024
569void fx_Atomics_waitAsync(txMachine* the)

Callers

nothing calls this directly

Calls 3

fxPushAtomicsValueFunction · 0.85
fxToNumberFunction · 0.85
fxWaitSharedChunkFunction · 0.85

Tested by

no test coverage detected