
Relinquishing ownership of a channel
A process relinquishes ownership of a channel by one of the following:
- Calling irDeinit(3IRAPI) � Returns channel ownership to the default owner or a pending owner. This is the recommended and preferred method to relinquish ownership of an irExec'ed process. It allows the library a chance to idle the channel and return it gracefully to the default owner, or to hand channel ownership to a pending process. The system considers process termination of channel owners to be an error and a system error is logged.
- Calling exit(2) or some other process termination, such as dumping core � Returns channel ownership to the default owner or a pending owner. By definition, transient processes exit(2) after successfully releasing a channel via irDeinit(3IRAPI) or irReturn(3IRAPI); however, if the channel is not in the IRS_IDLE state, the IRAPI, running in the context of the current channel owner, must idle the channel. Idling a channel may require asynchronous communication with other system processes. The process must wait for the IRE_DEINIT_DONE event before exiting. The code fragment below shows the expected behavior of transient processes. This example assumes that after the application completes a play, it releases the channel and exits. Note that IRE_DEINIT_DONE is disabled by default and must be explicitly enabled.
- Calling irExec(3IRAPI) to pass ownership to another process � Renders the channel_id invalid and removes channel ownership from the calling process after a successful return from irExec(3IRAPI).
- Calling irSubProg(3IRAPI) to pass ownership to another process � Renders the channel_id temporarily invalid (for the duration of the process being irSubProg'ed) and removes channel ownership from the calling process after a successful return from irSubProg(3IRAPI).
- Calling irReturn(3IRAPI) to pass ownership to another process � Renders the channel_id invalid and removes channel ownership from the calling process after a successful return from irReturn(3IRAPI).
- Having ownership forcibly removed � Generates the IRE_CHAN_REMOVED event and renders the channel_id invalid.
irWCheck(&ev) {
switch(ev.event_id) {
.
.
.
IRE_PLAY_DONE:
(void) irSetEvent(ev.cod, IRE_DEINIT_DONE, IRF_NOTIFY);
(void) irDeinit(ev.cid);
break;
IRE_DEINIT_DONE:
exit(0);
.
.
.
}
}