| 567 | |
| 568 | #if mxECMAScript2024 |
| 569 | void fx_Atomics_waitAsync(txMachine* the) |
| 570 | { |
| 571 | mxAtomicsDeclarations(1, 1, 0); |
| 572 | txNumber timeout; |
| 573 | txInteger result; |
| 574 | txSlot* slot; |
| 575 | fxPushAtomicsValue(the, 2, dispatch->value.typedArray.dispatch->constructorID); |
| 576 | timeout = (mxArgc > 3) ? fxToNumber(the, mxArgv(3)) : C_NAN; |
| 577 | if (c_isnan(timeout)) |
| 578 | timeout = C_INFINITY; |
| 579 | else if (timeout < 0) |
| 580 | timeout = 0; |
| 581 | result = (*dispatch->value.typedArray.atomics->wait)(the, host, offset, the->stack, timeout); |
| 582 | |
| 583 | mxPush(mxObjectPrototype); |
| 584 | slot = fxLastProperty(the, fxNewObjectInstance(the)); |
| 585 | slot = fxNextBooleanProperty(the, slot, (result <= 0) ? 0 : 1, mxID(_async), XS_NO_FLAG); |
| 586 | if (result < 0) |
| 587 | fxNextStringXProperty(the, slot, "not-equal", mxID(_value), XS_NO_FLAG); |
| 588 | else if (result == 0) |
| 589 | fxNextStringXProperty(the, slot, "timed-out", mxID(_value), XS_NO_FLAG); |
| 590 | else { |
| 591 | txSlot* resolveFunction; |
| 592 | txSlot* rejectFunction; |
| 593 | mxTemporary(resolveFunction); |
| 594 | mxTemporary(rejectFunction); |
| 595 | mxPush(mxPromiseConstructor); |
| 596 | fxNewPromiseCapability(the, resolveFunction, rejectFunction); |
| 597 | fxNextSlotProperty(the, slot, the->stack, mxID(_value), XS_NO_FLAG); |
| 598 | mxPop(); // promise |
| 599 | fxWaitSharedChunk(the, (txByte*)host->value.host.data + offset, timeout, resolveFunction); |
| 600 | mxPop(); // rejectFunction |
| 601 | mxPop(); // resolveFunction |
| 602 | } |
| 603 | mxPullSlot(mxResult); |
| 604 | } |
| 605 | #endif |
| 606 | |
| 607 | void fx_Atomics_xor(txMachine* the) |
nothing calls this directly
no test coverage detected