The pdiag_dd_watch_for_interrupt() function sleeps until a desired interrupt condition occurs, or a time-out occurs if the interrupt does not occur within the specified time.
#include <sys/pdiagex_dds.h> int32 pdiag_dd_watch_for_interrupt( handle, flag_mask, timeout_sec ) pdiag_info_handle_t handle; uint32 flag_mask; uint32 timeout_sec;
pdiag_dd_watch_for_interrupt() sleeps until a desired interrupt condition occurs or timeout_sec seconds pass. If the interrupt condition occurs before the routine is called, the function simply returns, without sleeping. To be awakened from the sleep state and get interrupt condition information, this routine is highly dependent on the interaction of the application's interrupt handler. This interaction is maintained by using the handle.flag_word, handle.sleep_word, and handle.sleep_flag.
The application's interrupt handler should update the handle.flag_word each time it receives an interrupt. The handle.flag_word and flag_mask format is determined by the application. The application's interrupt handler should also test the handle.sleep_flag each time it receives an interrupt to determine if the pdiag_dd_watch_for_interrupt() routine is sleeping. If handle.sleep_flag is TRUE, the application's interrupt handler should wake the pdiag_dd_watch_for_interrupt() routine using the pdiag_dd_interrupt_notify() service with handle.sleep_word as the sleep word.
The pdiag_dd_watch_for_interrupt() function can be called from the process environment.
|handle||Points to pdiag_info_handle_t structure which is returned from pdiag_open().|
|flag_mask||32-bit flag mask which, when bitwise ANDed with the handle.flag_word, produces a nonzero result only when the handle.flag_word identifies the desired interrupt condition.|
|timeout_sec||Number of seconds to watch for the interrupt condition before timing out. (A value of zero will never time-out; possible hang condition).|
The pdiag_dd_watch_for_interrupt function returns one of the following values:
|DGX_OK||The operation was successful. The errno is not set.|
|DGX_FAIL||The interrupt condition did not occur before timeout_sec seconds passed.|
|DGX_INVALID_HANDLE||Specified handle has been closed or was not generated by the pdiag_open() call. The errno is not set.|