changeset 817:ca97f6817eda

* tests/pselect.c (pthread_entry1): Allow for infrequent but occasional off by one error due to race condition when signalling.
author jlarmour
date Sat, 08 Mar 2003 03:36:32 +0000
parents b4a3f003fc22
children c9e9d4163174
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/tests/pselect.c
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-08  Jonathan Larmour  <jifl@eCosCentric.com>
+
+	* tests/pselect.c (pthread_entry1): Allow for infrequent but
+	occasional off by one error due to race condition when
+	signalling.
+
 2003-02-24  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* cdl/fileio.cdl: Add doc link.
--- a/packages/io/fileio/current/tests/pselect.c
+++ b/packages/io/fileio/current/tests/pselect.c
@@ -234,6 +234,13 @@ void *pthread_entry1( void *arg)
         
     }
 
+    // If we were interrupted at just the wrong point above we may still
+    // have a SIGUSR1 signal pending that we didn't handle, and so won't
+    // have accounted for. So let's look...
+    CYG_TEST_CHECK( 0 == sigpending( &mask ), "sigpending() returned error");
+    if (1 == sigismember(&mask, SIGUSR1) )
+        pselect_eintr++;
+
     pthread_sigmask( SIG_SETMASK, &oldmask, NULL );
 
     pthread_exit(arg);