This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix pselect test


It was possible for the pselect test to get an off by one error due to a race condition when finishing up the test.

Attached patch checked in to trunk.

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.28
diff -u -5 -p -r1.28 ChangeLog
--- ChangeLog	24 Feb 2003 14:24:27 -0000	1.28
+++ ChangeLog	8 Mar 2003 03:34:26 -0000
@@ -1,5 +1,11 @@
+2003-03-08  Jonathan Larmour  <jifl at eCosCentric dot 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 at eCosCentric dot com>
 
 	* cdl/fileio.cdl: Add doc link.
 
 2003-02-20  Bart Veer  <bartv at ecoscentric dot com>
Index: tests/pselect.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/tests/pselect.c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 pselect.c
--- tests/pselect.c	11 Nov 2002 23:58:53 -0000	1.1
+++ tests/pselect.c	8 Mar 2003 03:34:26 -0000
@@ -232,10 +232,17 @@ void *pthread_entry1( void *arg)
         if( err > 0 ) show_fdsets( "Thread1 result: ", 8, &rd_res, &wr_res, NULL );
         pselect_wakeups++;
         
     }
 
+    // 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);
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]