| gclib 1.34.15 Communications API for Galil controllers and PLCs |

## ◆ GInterrupt()

GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt | ( | GCon | g,
|  | GStatus * | status_byte
| ) |  |

Provides access to PCI and UDP interrupts from the controller.

Interrupts can be generated automatically by the firmware on important events via `EI` (Enable Interrupt) or by the user in embedded DMC code via `UI` (User Interrupt). To use this function, `-s EI` must be used in the GOpen() address string to subscribe to interrupts.

Parameters

  g | Connection's handle.
  status_byte | A pointer to a GStatus to receive the status byte.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

GInterrupt() will block until an interrupt is received, or the function times out.

Note
  If this function is called with a timeout of zero, a non-blocking read is performed. If interrupt data is waiting in the interrupt queue, the oldest byte will be popped off the queue. If there is no interrupt data queued, but there is data waiting in the socket or PCI FIFO, one read will be performed to process the waiting data. If new data is still not found after these two attempts, G_GCLIB_NON_BLOCKING_READ_EMPTY will be returned.

See x_ginterrupt.cpp for an example. See x_nonblocking.cpp for an example of non-blocking usage.

Referenced by check_interrupts(), and motion_complete().