Skip site navigation (1) Skip section navigation (2)

Re: Proper use of select() parameter nfds?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Hagerty <mhagerty(at)voyager(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proper use of select() parameter nfds?
Date: 2001-07-06 13:29:02
Message-ID: 6930.994426142@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Matthew Hagerty <mhagerty(at)voyager(dot)net> writes:
> I take this to mean that each descriptor set contains n descriptors

No.  nfds is the length (in bits) of the bit arrays passed to select().
Therefore, it is possible to inquire about descriptors numbered between
0 and nfds-1.  One sets the bits corresponding to the interesting
descriptors before calling select, and then examines those bits to see
if they're still set on return.

The code you quoted is perfectly correct, for code that is only
interested in one descriptor.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Jan WieckDate: 2001-07-06 13:40:47
Subject: pgsql/src/backend/rewrite rewriteHandler.c
Previous:From: Tom LaneDate: 2001-07-06 13:14:03
Subject: Re: AW: Re: Backup and Recovery

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group