pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrea Grassi <andreagrassi@sogeasoft.com>
Cc: 'Craig Ringer' <ringerc@ringerc.id.au>
Cc: harrywr2@comcast.net
Cc: 'Pg Bugs' <pgsql-bugs@postgresql.org>
Cc: 'Alvaro Herrera' <alvherre@commandprompt.com>
Subject: Re: R: R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
Date: Wed, 21 Dec 2011 11:00:34 -0500
Message-ID: <5744.1324483234@sss.pgh.pa.us> (raw)
In-Reply-To: <000c01ccbfd6$1d5a5e70$580f1b50$@com>
References: <E1RbSUA-0003kd-Tb@wrigleys.postgresql.org>
	<4EEB0006.7080205@ringerc.id.au>
	<001201ccbbfc$82c987a0$885c96e0$@com>
	<4EEC3462.80702@ringerc.id.au>
	<000601ccbef6$060820d0$12186270$@com>
	<1324395708-sup-4443@alvh.no-ip.org>
	<001701ccbf34$72480970$56d81c50$@com>
	<20092.1324399103@sss.pgh.pa.us>
	<002301ccbf3c$cc34b110$649e1330$@com>
	<6410.1324402946@sss.pgh.pa.us>
	<4EF12097.5060907@ringerc.id.au>
	<000c01ccbfd6$1d5a5e70$580f1b50$@com>

"Andrea Grassi" <andreagrassi@sogeasoft.com> writes:
> In internet I searched for detailed specifications of poll/select system
> functions but I didn't understand one thing, that is which one of the 2
> statement is true:
> 1) poll/select wait only for FUTURE modifications of ready-read state of
> sockets
> 2) poll/select check if there is something to read at the moment of the call
> and otherwise wait for FUTURE modifications of ready-read state

#1 is nonsense.  If poll worked like that, it would be impossible for
anyone to use it without suffering from race conditions.  But if you
don't see where exactly the poll() specification says so, I observe
that it says first that poll sets the bit(s) if the requested condition
is true, and second that *if* none of the events have occurred yet,
poll should wait.  See for instance
http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.html

			regards, tom lane



view thread (2+ messages)

Message-ID: <5744.1324483234@sss.pgh.pa.us>
Permalink:  ../5744.1324483234@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5744.1324483234@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andreagrassi@sogeasoft.com, ringerc@ringerc.id.au, harrywr2@comcast.net, alvherre@commandprompt.com
  Subject: Re: R: R: R: R: R: BUG #6342: libpq blocks forever in "poll" function
  In-Reply-To: <5744.1324483234@sss.pgh.pa.us>
  References: <E1RbSUA-0003kd-Tb@wrigleys.postgresql.org> <4EEB0006.7080205@ringerc.id.au> <001201ccbbfc$82c987a0$885c96e0$@com> <4EEC3462.80702@ringerc.id.au> <000601ccbef6$060820d0$12186270$@com> <1324395708-sup-4443@alvh.no-ip.org> <001701ccbf34$72480970$56d81c50$@com> <20092.1324399103@sss.pgh.pa.us> <002301ccbf3c$cc34b110$649e1330$@com> <6410.1324402946@sss.pgh.pa.us> <4EF12097.5060907@ringerc.id.au> <000c01ccbfd6$1d5a5e70$580f1b50$@com> <5744.1324483234@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox