[−][src]Function sunrise_libuser::syscalls::wait_synchronization
pub fn wait_synchronization(
handles: &[HandleRef],
timeout_ns: Option<usize>
) -> Result<usize, KernelError>
Wait for an event on the given handles.
When zero handles are passed, this will wait forever until either timeout or cancellation occurs.
If a timeout of 0 is passed, this function is guaranteed not to reschedule.
Does not accept 0xFFFF8001 or 0xFFFF8000 meta-handles.
Object types
- KDebug: signals when there is a new DebugEvent (retrievable via GetDebugEvent).
- KClientPort: signals when the number of sessions is less than the maximum allowed.
- KProcess: signals when the process undergoes a state change (retrievable via #svcGetProcessInfo).
- KReadableEvent: signals when the event's corresponding KWritableEvent has been signaled via svcSignalEvent.
- KServerPort: signals when there is an incoming connection waiting to be accepted.
- KServerSession: signals when there is an incoming message waiting to be received or the pipe is closed.
- KThread: signals when the thread has exited.
Result codes
- 0x0000: Success. One of the objects was signaled before the timeout expired, or one of the objects is a Session with a closed remote. Handle index is updated to indicate which object signaled.
- 0x7601: Thread termination requested. Handle index is not updated. Cannot happen when timeout is 0.
- 0xe401: Invalid handle. Returned when one of the handles passed is invalid. Handle index is not updated.
- 0xe601: Invalid address. Returned when the handles pointer is not a readable address. Handle index is not updated.
- 0xea01: Timeout. Returned when no objects have been signaled within the timeout. Handle index is not updated.
- 0xec01: Interrupted. Returned when another thread uses svcCancelSynchronization to cancel this thread. Handle index is not updated. Cannot happen when timeout is 0.
- 0xee01: Too many handles. Returned when the number of handles passed is >0x40. Note: Sunrise kernel currently does not return this error. It is perfectly able to wait on more than 0x40 handles.