Re: signals and read blocking - EINTR

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Christopher Faylor-2
On Mon, Oct 31, 2005 at 08:49:30PM -0700, Jim Easton wrote:
>I'm wondering what am I missing?  Is there a flag in sigaction
>or something else that I could be setting?

Yes.  SA_RESTART is the flag.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Samuel Thibault
Christopher Faylor, le Tue 01 Nov 2005 01:02:40 -0500, a ?crit :
> On Mon, Oct 31, 2005 at 08:49:30PM -0700, Jim Easton wrote:
> >I'm wondering what am I missing?  Is there a flag in sigaction
> >or something else that I could be setting?
>
> Yes.  SA_RESTART is the flag.

No: he wants to be _interrupted_. SA_RESTART is used for _not_ being
interrupted, i.e. the system restarts the system call itself.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Jim Easton
In reply to this post by Christopher Faylor-2
Hi,

Christopher Faylor wrote:
> On Mon, Oct 31, 2005 at 08:49:30PM -0700, Jim Easton wrote:
> >I'm wondering what am I missing?  Is there a flag in sigaction
> >or something else that I could be setting?
>
> Yes.  SA_RESTART is the flag.

and then Samuel Thibault wrote:
> No: he wants to be _interrupted_. SA_RESTART is used for _not_ being
> interrupted, i.e. the system restarts the system call itself.

Thank you both for your help.  It's quite true that I do want to be
interrupted and SA_RESTART is to prevent it.

However it never occurred to me on linux and cygwin the flag would
be defaulted set.  Things started to work much better when I
deliberately unset the flag.

It seems to be working quite nicely on cygwin now but I'm now having
some trouble with the "saved" value of the timer which I haven't
sorted out yet.  I don't know that it's not my bug.

Thanks for the prod.

        Jim




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Samuel Thibault
Hi,

Jim Easton, le Tue 01 Nov 2005 02:40:00 -0700, a ?crit :

> Hi,
>
> Christopher Faylor wrote:
> > On Mon, Oct 31, 2005 at 08:49:30PM -0700, Jim Easton wrote:
> > >I'm wondering what am I missing?  Is there a flag in sigaction
> > >or something else that I could be setting?
> >
> > Yes.  SA_RESTART is the flag.
>
> and then Samuel Thibault wrote:
> > No: he wants to be _interrupted_. SA_RESTART is used for _not_ being
> > interrupted, i.e. the system restarts the system call itself.
>
> Thank you both for your help.  It's quite true that I do want to be
> interrupted and SA_RESTART is to prevent it.
>
> However it never occurred to me on linux and cygwin the flag would
> be defaulted set.  Things started to work much better when I
> deliberately unset the flag.

Mmm, I had a look at posix, at it says "The state of these flags is
not specified for signal()." So that you indeed need to explicitely
unset the flag, else the behavior is implementation-dependant (BSD sets
SA_RESTART and clears SA_RESETHAND for instance).

Alternatively, siginterrupt() might be useful, but sigaction is
preferred.

Regards,
Samuel

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Christopher Faylor-2
In reply to this post by Jim Easton
On Tue, Nov 01, 2005 at 02:40:00AM -0700, Jim Easton wrote:

>Christopher Faylor wrote:
>>On Mon, Oct 31, 2005 at 08:49:30PM -0700, Jim Easton wrote:
>>>I'm wondering what am I missing?  Is there a flag in sigaction or
>>>something else that I could be setting?
>>
>>Yes.  SA_RESTART is the flag.
>
>and then Samuel Thibault wrote:
>>No: he wants to be _interrupted_.  SA_RESTART is used for _not_ being
>>interrupted, i.e.  the system restarts the system call itself.
>
>Thank you both for your help.  It's quite true that I do want to be
>interrupted and SA_RESTART is to prevent it.

Which was my point, actually.

I do kinda know this stuff.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply | Threaded
Open this post in threaded view
|

Re: signals and read blocking - EINTR

Jim Easton
In reply to this post by Christopher Faylor-2
Hi

Samuel Thibald wrote:

> Mmm, I had a look at posix, at it says "The state of these flags is
> not specified for signal()." So that you indeed need to explicitely
> unset the flag, else the behavior is implementation-dependant (BSD sets
> SA_RESTART and clears SA_RESETHAND for instance).
>
> Alternatively, siginterrupt() might be useful, but sigaction is
> preferred.
>
> Regards,
> Samuel

Yes, I will keep that in mind.

There are a couple of other flags that are set on the other
architectures which I haven't investigated yet (read; I don't know
what they do), but it's working now on Cygwin, Solaris, SGI, AIX and
Linux.  (The sun4s need a little tweeking)

Thank you and Chris Faylor for your help - much appreciated.

        Jim


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/