Newsgroups: comp.parallel.pvm
From: bonnefoi@alpha1.unilim.fr (Laboratoire Informatique - M. Bonnefoi -)
Subject: Re: What is fd_set
Organization: Centre Universitaire de Calcul de Limoges
Date: 13 Dec 1995 10:37:08 GMT
Message-ID: <4amack$q4t@sunncs.unilim.fr>

Cheng Wen-Bin (cwb81u@cs.ccu.edu.tw) wrote:
: Hi:

: what is 'fd_set' ?

fd_set is a macro what mark a bit in a computer word (AND function).

example : fd_set (File_Descritpor, &File_descriptor_set)

This bit, and others (marked by the same way) give the number(s) of file 
descriptor(s) from what the function 'select' perform its action :

 fd_set (File_Descritpor, &File_descriptor_set);
 select (FD_SETSIZE, &File_descriptor_set, NULL, NULL, NULL);
	  |		    |		     |	  |	 |
	  |		    |		     |	  |	 |-> time to wait
          |                 |                |    |
	  |		    |		     |	  |-> f.d. with exceptions
          |                 |                |
	  |		    |		     |-> file desc. good for write
          |                 |
	  |		    |->file desc. good for read                 
          |
          |-> Maximum number for file descriptors

In this example, Select wait until the file descriptors, shown by the 
file_descriptor_set become ready to read or the wait time become exceeded.

It's a very convenient way to write communication daemon what have not to wait
with polling and 'active wait'.

hope this help and could be understood despite my english skills...

P-F.
--
 ---------------------------------------------------------------------------
|  Bonnefoi Pierre-Francois   |         E-mail : bonnefoi@unilim.fr         |
|  Universite de Limoges      |---------------------------------------------|
|  Departement d'Informatique |                      sin x                  |
|  Laboratoire M.S.I.         |               lim   ------- = 6             |
|  123, avenue Albert Thomas  |              n->inf    n                    |
|  87060 Limoges cedex        |                                             |
 ---------------------------------------------------------------------------


