POSIX pause()

Jonathan Larmour jifl@eCosCentric.com
Tue Jul 18 16:00:00 GMT 2006


This is an old chestnut discussed with Gary many moons ago, that I was 
waiting for some confirmation before checking in. I guess I'll just check 
it in now!

Jifl

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/ChangeLog,v
retrieving revision 1.51
diff -u -5 -p -r1.51 ChangeLog
--- ChangeLog   16 Jun 2006 18:21:16 -0000      1.51
+++ ChangeLog   18 Jul 2006 15:58:35 -0000
@@ -1,5 +1,10 @@
+2006-07-18  Jonathan Larmour  <jifl@eCosCentric.com>
+
+       * src/signal.cxx (pause): Although already POSIX compliant, if we wait
+       for all signals, behaviour is more Linux-like.
+
  2006-06-13  Dan Jakubiec  <dan.jakubiec@systech.com>

         * src/time.cxx: (nanosleep): Fixed to return EINTR when it is
         interrupted by a signal.  This in turn fixed sleep() to return the
         number of unelapsed seconds when interrupted by a signal.
Index: src/signal.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/src/signal.cxx,v
retrieving revision 1.18
diff -u -5 -p -r1.18 signal.cxx
--- src/signal.cxx      4 Oct 2004 11:49:19 -0000       1.18
+++ src/signal.cxx      18 Jul 2006 15:58:37 -0000
@@ -8,10 +8,11 @@
  //####ECOSGPLCOPYRIGHTBEGIN####
  // -------------------------------------------
  // This file is part of eCos, the Embedded Configurable Operating System.
  // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
  // Copyright (C) 2002 Nick Garnett
+// Copyright (C) 2004 eCosCentric Ltd.
  //
  // eCos is free software; you can redistribute it and/or modify it under
  // the terms of the GNU General Public License as published by the Free
  // Software Foundation; either version 2 or (at your option) any later 
version.
  //
@@ -1066,16 +1067,13 @@ externC int pause( void )

      signal_mutex.lock();

      // Check for any pending signals that can be delivered and
      // if there are none, wait for a signal to be generated
-    if( !cyg_deliver_signals() )
+    while( !cyg_deliver_signals() )
          signal_sigwait.wait();

-    // Now check again for some signals to deliver
-    cyg_deliver_signals();
-
      signal_mutex.unlock();

      SIGNAL_RETURN(EINTR);
  }



-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
------["The best things in life aren't things."]------      Opinions==mine



More information about the Ecos-patches mailing list