*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> standard/qgetfd (3)              


qgetfd(3G)							    qgetfd(3G)

NAME    [Toc]    [Back]

     qgetfd - get the read file	descriptor associated with the event queue

C SPECIFICATION    [Toc]    [Back]

     long qgetfd(void)

PARAMETERS    [Toc]    [Back]


     The returned function value is the	read file descriptor associated	with
     the event queue.  If there	is an error, the returned value	is a negative
     integer whose absolute value is an	error value defined in <errno.h>.

DESCRIPTION    [Toc]    [Back]

     qgetfd returns the	read file descriptor associated	with the event queue.
     The file descriptor can then be used with the select(2) system call.

EXAMPLE    [Toc]    [Back]

     The following example (presented in pseudo-code; not to be	typed
     verbatim) is suggested for	reading	events off of the GL queue using

	  if ((glfd = qgetfd())	< 0) {
	      printf("bad file descriptor %d0, glfd);
	  for (;;) {
	      while (qtest()) {
	      /* Make sure all GL rendering which may be acting	as a prompt or
	       * cue for the user has completed	before checking	for a response
	       * from the user.
	      FD_SET(glfd,&readfds);	   /* select with qgetfd descriptor   */
	      FD_SET(,);		   /* select with others descriptors  */
	      nfound = select (,&readfds,,,);
	      if (FD_ISSET(glfd,&readfds)) /* process queue events	      */
	      if (FD_ISSET(,)) {	   /* process other then queue events */

									Page 1

qgetfd(3G)							    qgetfd(3G)

     The example provides two important	pieces of advice. First, use blkqread
     instead of	multiple qreads	because	it is more efficient.  Second, to
     ensure the	proper behavior	of select, call	qtest before and after you
     call select. When select indicates	data is	available on the file
     descriptor, there may not be GL event data	to read.  Similarly, there is
     a condition where select would block, but data is available. The use of
     qtest before and after select guards against this.

SEE ALSO    [Toc]    [Back]

     qread, gflush, select(2) (in the Programmer's Reference Manual)

NOTES    [Toc]    [Back]

     This routine is available only in immediate mode.

BUGS    [Toc]    [Back]

     The file descriptor returned by qgetfd will not be	detected as ready for
     reading by	the system call	select(2) when TIMER events are	inserted into
     the queue.	 Instead, one should use the timeout feature of	select(2) to
     achieve the same functionality.

									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
alGetEventQueueFD IRIX get the file descriptor for an audio event queue
read Linux read from a file descriptor
poll Linux wait for some event on a file descriptor
pread Linux read from or write to a file descriptor at a given offset
alPendingEvents IRIX Get total number of event queued in event queue
mq_open Tru64 Establishes the connection between a message queue and a message queue descriptor (P1003.1b)
alCheckEvent IRIX Looks for an event in the event queue and retrieves it.
mq_close HP-UX close a message queue descriptor
mq_close IRIX close a message queue descriptor
mq_setattr HP-UX set the blocking status of a message queue associated with a descriptor
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service