EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: RTEMS tests -- epicsThreadOnce broken?
From: Andrew Johnson <[email protected]>
To: Eric Norum <[email protected]>
Cc: EPICS core-talk <[email protected]>
Date: Fri, 29 Oct 2010 11:24:06 -0500
On Friday 29 October 2010 11:12:25 you wrote:
> BTW -- when you make the change to extend the sleep in the epicsThreadOnce
> test will you add the test I added for epicsEvent semantic tests to
> epicsEventTest.cpp and the appDevGuide?   Or is that too big for now -- and
> will be in 3.15?

Adding tests to a -pre release is fine as long as they're supposed to pass; 
I've not actually looked at your patch yet though.  You forgot to attach the 
appdev patch to that message.

> Thanks for the epicsThreadOnce test fix!

I think I'll actually fix it with the additional epicsEventSignal() and 
epicsEventMustWait() which I've just written:

=== modified file 'src/libCom/test/epicsThreadOnceTest.c'
--- src/libCom/test/epicsThreadOnceTest.c       2010-10-05 19:27:37 +0000
+++ src/libCom/test/epicsThreadOnceTest.c       2010-10-29 16:19:13 +0000
@@ -22,6 +22,7 @@
 epicsThreadOnceId twiceFlag = EPICS_THREAD_ONCE_INIT;
 epicsMutexId lock;
 epicsEventId go;
+epicsEventId done;

 int runCount  = 0;
 int initCount = 0;
@@ -49,6 +50,8 @@

     epicsMutexMustLock(lock);
     doneCount++;
+    if (doneCount == runCount)
+        epicsEventSignal(done);
     epicsMutexUnlock(lock);
 }

@@ -79,6 +82,7 @@
     testPlan(3 + NUM_ONCE_THREADS);

     go = epicsEventMustCreate(epicsEventEmpty);
+    done = epicsEventMustCreate(epicsEventEmpty);
     lock = epicsMutexMustCreate();

     for (i = 0; i < NUM_ONCE_THREADS; i++) {
@@ -93,11 +97,12 @@

     testOk(runCount == NUM_ONCE_THREADS, "runCount = %d", runCount);
     epicsEventSignal(go);
-    epicsThreadSleep(0.1);
+    epicsEventMustWait(done);

     testOk(doneCount == NUM_ONCE_THREADS, "doneCount = %d", doneCount);
     testDiag("init was run by %s", initBy);

+    testDiag("Expecting thread recurse to suspend:");
     tid = epicsThreadCreate("recurse", epicsThreadPriorityMedium,
             epicsThreadGetStackSize(epicsThreadStackSmall),
             recurseThread, 0);


-- 
If a man is offered a fact which goes against his instincts, he will
scrutinize it closely, and unless the evidence is overwhelming, he will
refuse to believe it.  If, on the other hand, he is offered something
which affords a reason for acting in accordance to his instincts, he
will accept it even on the slightest evidence.  -- Bertrand Russell


Navigate by Date:
Prev: Re: RTEMS tests -- epicsThreadOnce broken? Eric Norum
Next: epicsEvent semantics Eric Norum
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: RTEMS tests -- epicsThreadOnce broken? Eric Norum
Next: epicsEvent semantics Eric Norum
Index: 2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·