libpq C library Client Interface - select()

Started by Nonameabout 23 years ago2 messagesgeneral
Jump to latest
#1Noname
jco@cornelius-olsen.dk

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

#2Noname
jco@cornelius-olsen.dk
In reply to: Noname (#1)
Re: libpq C library Client Interface - select()

That is it. Thanks.
It just never occurred to me that it would be a non-libpq function.

/Jørn

How about 'man select'.

---------------------------------------------------------------------------

jco@cornelius-olsen.dk wrote:

Show quoted text

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