xpc_connection_suspend(_:)
Suspends the connection so the event handler block doesn’t fire and the connection doesn’t attempt to send any messages it has in its queue.
Declaration
func xpc_connection_suspend(_ connection: xpc_connection_t)Parameters
- connection:
The connection object which is to be manipulated.
Discussion
All calls to xpc_connection_suspend(_:) must be balanced with calls to xpc_connection_resume(_:) before releasing the last reference to the connection.
Suspension is asynchronous and non-preemptive, and therefore this method will not interrupt the execution of an already-running event handler block. If the event handler is executing at the time of this call, it will finish, and then the connection will be suspended before the next scheduled invocation of the event handler. The XPC runtime guarantees this non-preemptiveness even for concurrent target queues.
Connection event handlers are non-reentrant, so it is safe to call xpc_connection_suspend(_:) from within the event handler block.