ntfn_wait
| Number | 0x26 |
|---|---|
| Signature | (ntfn_handle, timeout_ms) -> bits or -err |
| Group | handles |
| Since | 1.0 |
| Blocking | conditional |
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
| Register | Name | Description |
|---|---|---|
r0 | ntfn_handle | Handle of the notification |
r1 | timeout_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
| Code | Condition |
|---|---|
ERR_TIMEOUT | Deadline expired, or a poll found no bits set |
ERR_BADHANDLE | No such handle |
ERR_BADTYPE | Handle is not a notification |
ERR_DEAD | The notification object is dead |