libpq C library Client Interface - select()

From: jco(at)cornelius-olsen(dot)dk
To: pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: libpq C library Client Interface - select()
Date: 2003-01-18 15:08:52
Message-ID: OFE0A20DB5.46EB5199-ONC1256CB2.00532607@dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces

Hi,

Several places in the docs references something called "select()". One
example:

A better way to check for NOTIFY messages when you have no useful queries
to make is to call PQconsumeInput(), then check PQnotifies(). You can use select() to wait for backend data to arrive, thereby using no CPU power unless
there is something to do. (See PQsocket() to obtain the file descriptor number to use with select().)

My problem is that I can find no information on what "select()" is or how
it's used. Does anyone have any pointers?
My particular interest is that I'd like to find out how to do modify the
test program "testlibpq2.c" to use "select()" as suggested in the comments:

/*
* wait a little bit between checks; waiting with select()
* would be more efficient.
*/
Thanks in advance.
/Jørn

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-01-18 15:26:09 Re: change in behaviour? Is this a regression in function?
Previous Message Gavin Atkinson 2003-01-18 11:18:00 Re: change in behaviour? Is this a regression in function?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Key88 SF 2003-01-18 18:34:37 Re: libpq C library Client Interface - select()
Previous Message Alexandros Perdikomatis 2003-01-18 14:17:24 Database backup