bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Socket::isPending () issue


From: David Sugar
Subject: Re: Socket::isPending () issue
Date: Fri, 22 Feb 2002 14:07:50 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20020107

We had been a bit busy with the Common C++ "2" release, so I had not had a chance to think about this question until now...

Interuppted system calls can happen from signal handlers that have "sa_interrupt" set. If one resumes the poll and there is data pending as well, the poll should then drop back out immediately and not keep looping. However, there is no harm in examining the returned struct for pending data rather than looping right back.

In the case of select, I do not know why we did not do the same, but I think the immediate fallback loop in poll might be a mistake, as you point out.

Pavel Tsekov wrote:

Hello :)

I want to raise another issue witch have made be go crazy for the
last few days :) On unices, based on your system a decision is made
if poll () or select () will be used to check if network data is
available for reading/writing. One would assume that using either of
these will give him the same result - but not. The version of Socket::isPending
() which uses poll () has an additional check - if the return value of
poll is -1 then a check is made if errno is set to EINTR and if
positive poll () is called again. This may result in an infinite loop.

I have a code which sends data through a tcpstream instance. Before
each write I do a Readline() with a timeout of 1000 milliseconds
to see if the other end wants to inform me of something. This seemed
to work fine though if I send a large amount of data (more than 5 Mb)
I got struck buy this issue - at some point the code blocks in the
isPending () and cannot get out of there. I solved the issue by using
the version of isPending () which uses select ().

Now my question is - what's the purpose for this difference in the
behaviour of isPending ().

Thanks ;)

P.S. The system is: i386 runnning RedHat Linux 7.2 - everything is stock, no
installation of custom packages.


_______________________________________________
Bug-commoncpp mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-commoncpp







reply via email to

[Prev in Thread] Current Thread [Next in Thread]