Sun Microsystems 800-1256-04 — Sun Microsystems 800-1256-04 SunCGI Reference Manual PDF (EN)

Chapter 5 - Input 83 0 initialized with or the value the device had when it was in a state where it could process events. Tilis is not necessarily the current measure of the device and does not change while the device is in this state. RESPOND_EVENT The RESPOND_EVENT state corresponds with synchronous communication between the process that controls the input device and the application pro- gram. When an application program requests the measure of an input device in RESPOND_EVENT state, SunCGI blocks program execution until it can fulfill the request. The request_input function will return when the trigger fires and tbe input request is satisfied or after a timeout period.

The input device then reverts to NO_ EVENTS state. The function that requests input and puts the input device in RESPOND _EVENT state is request input. Wl).en the trigger associated with an input device in RESPOND_ EVENT state fires, the measure of that input device is then stored in the request register as well as returned by the request_input function. REQUEST _EVENT The REQUEST_EVENT state corresponds with asynchronous communication between the process that controls the input device and the application pro- gram. When an application samples an input device, input handling and pro- gram execution continue in parallel.

Either the requested trigger fires or an explicit request is made to disable event processing and return the device to NO_EVENTS state. 0 When the trigger associated with an input device in REQUEST_ EVENT state fires, tli.e measure of that input device is then stored in the request register, a buffer with one element per device. The request register can be then be read with get_last_requested_event. QUEUE EVENT When a device is in QUEUE_ EVENT mode, events associated with the indi- cated device are appended to the event queue, a first-in, first-out (FIFO) buffer shared by all input devices. After calling enable_ events, the SunCGI application retains program control.

While an input device is in QUEUE_ EVENT mode, events are simultaneously added to the event queue when the program executes. await_event returns the event at the head of the event queue. If the queue is empty, await_event will wait for the designated trigger to fire or a timeout. The application program must process this queue in a timely fashion or it will qverjlow. The event queue can be flushed completely or for a specific device. The application program must make an explicit request to disable event queue processing and return an input device to NO_ EVENTS state. 0 ~~sun ... 11Ln.a,:11e1Ta Version C of 17 March 1986