ntfn_wait

Number0x26
Signature(ntfn_handle, timeout_ms) -> bits or -err
Grouphandles
Since1.0
Blockingconditional

Read and clear a notification’s bits, blocking until at least one is set.

If bits are already pending the call returns immediately with them, whatever the timeout. A poll on an empty notification returns ERR_TIMEOUT rather than zero, so a successful return always carries at least one bit.

Sub-millisecond timeouts are rounded up to a single tick rather than to zero, so a short timeout never degenerates into a poll.

Pitfalls

The read is destructive: bits are cleared on return, so there is no way to inspect them without consuming them.

A waiter woken by ntfn_signal receives every bit accumulated at that moment, not only the bits from the signal that woke it.

Arguments

RegisterNameDescription
r0ntfn_handleHandle of the notification
r1timeout_ms`TIMEOUT_POLL` to poll, `TIMEOUT_INFINITE` to block forever, otherwise a deadline in milliseconds

Returns

The accumulated bits. Always non-negative, since bit 31 cannot be set.

Errors

CodeCondition
ERR_TIMEOUTDeadline expired, or a poll found no bits set
ERR_BADHANDLENo such handle
ERR_BADTYPEHandle is not a notification
ERR_DEADThe notification object is dead

See also