From: crincon@et.com.mx (Cesar Rincon)
To: linux-c-programming@vger.kernel.org
Subject: accept() and signals
Date: Wed, 31 Mar 2004 14:59:30 -0600 [thread overview]
Message-ID: <20040331205930.GC24581@et.com.mx> (raw)
Hi.
I have a program that installs a handler for SIGINT and SIGTERM (using
signal(), not sigaction()). This handler only sets a global flag and
returns. The flag is checked elsewhere to initiate a graceful
shutdown. The program is not multithreaded.
When the program is blocked on a call to accept(), and a signal is
received, I would expect my handler to execute, and also accept() to
return immediately with EINTR, allowing me to check my flag, etc.
Actually, when compiled in AIX, it behaves precisely that way.
However, in Linux (2.6.3), the handler is in fact executed, but
accept() does not seem to unblock. Thus my program does not shutdown
until a new connection is accepted.
I feel like I fell into some obvious and documented gotcha, but I
really can not see what it is that I'm doing wrong, and Google is not
helping. Is this the expected behaviour of accept(), in Linux?
-CR
--
Ceterum censeo: SCO delenda est.
next reply other threads:[~2004-03-31 20:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-31 20:59 Cesar Rincon [this message]
2004-03-31 22:21 ` accept() and signals Glynn Clements
2004-03-31 23:54 ` Cesar Rincon
2004-04-01 0:58 ` Glynn Clements
2004-04-01 3:08 ` Cesar Rincon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040331205930.GC24581@et.com.mx \
--to=crincon@et.com.mx \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).