linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* accept() and signals
@ 2004-03-31 20:59 Cesar Rincon
  2004-03-31 22:21 ` Glynn Clements
  0 siblings, 1 reply; 5+ messages in thread
From: Cesar Rincon @ 2004-03-31 20:59 UTC (permalink / raw)
  To: linux-c-programming

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-04-01  3:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-31 20:59 accept() and signals Cesar Rincon
2004-03-31 22:21 ` Glynn Clements
2004-03-31 23:54   ` Cesar Rincon
2004-04-01  0:58     ` Glynn Clements
2004-04-01  3:08       ` Cesar Rincon

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).