EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: epicsEvent (posix implementation) bug ?
From: Till Straumann <[email protected]>
To: EPICS Techtalk <[email protected]>
Date: Fri, 28 Jan 2011 19:57:02 -0600
If multiple threads block on the same event then the current
implementation (posix) may spuriously wake up more than
one thread as a result of epicsEventSignal().

This is because the underlying pthread_cond_signal()/pthread_cond_wait()
explicitly have these same semantics.

IMO it would be a good idea to change epicsEventWait and epicsEventWaitWithTimeout so that they handle this possible
case (and yield the same semantics as the RTEMS and vxWorks
variants).

-- Till

*** base-3-14-12/src/libCom/osi/os/posix/osdEvent.c.orig	2011-01-28 19:49:39.345588580 -0600
--- base-3-14-12/src/libCom/osi/os/posix/osdEvent.c	2011-01-28 19:51:58.901443789 -0600
***************
*** 133,139 ****
      status = mutexLock(&pevent->mutex);
      checkStatusQuit(status,"pthread_mutex_lock","epicsEventWait");
      /*no need for while since caller must be prepared for no work*/
!     if(!pevent->isFull) {
          status = condWait(&pevent->cond,&pevent->mutex);
          checkStatusQuit(status,"pthread_cond_wait","epicsEventWait");
      }
--- 133,139 ----
      status = mutexLock(&pevent->mutex);
      checkStatusQuit(status,"pthread_mutex_lock","epicsEventWait");
      /*no need for while since caller must be prepared for no work*/
!     while (!pevent->isFull) {
          status = condWait(&pevent->cond,&pevent->mutex);
          checkStatusQuit(status,"pthread_cond_wait","epicsEventWait");
      }
***************
*** 151,157 ****
  
      status = mutexLock(&pevent->mutex);
      checkStatusQuit(status,"pthread_mutex_lock","epicsEventWaitWithTimeout");
!     if(!pevent->isFull) {
          convertDoubleToWakeTime(timeout,&wakeTime);
          status = condTimedwait(
              &pevent->cond,&pevent->mutex,&wakeTime);
--- 151,157 ----
  
      status = mutexLock(&pevent->mutex);
      checkStatusQuit(status,"pthread_mutex_lock","epicsEventWaitWithTimeout");
!     while (!pevent->isFull && 0 == status) {
          convertDoubleToWakeTime(timeout,&wakeTime);
          status = condTimedwait(
              &pevent->cond,&pevent->mutex,&wakeTime);

Replies:
RE: epicsEvent (posix implementation) bug ? james.rowland
Re: epicsEvent (posix implementation) bug ? Andrew Johnson

Navigate by Date:
Prev: Re: epicsMessageQueue Linux PREEMPT_RT Till Straumann
Next: Motor driver for Parker Hannifin ACR series controllers? Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ca_create_subscription element count Jeff Hill
Next: RE: epicsEvent (posix implementation) bug ? james.rowland
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·