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  <20092010  2011  2012  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  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: 2 cents of pedantry
From: Till Straumann <[email protected]>
To: EPICS Techtalk <[email protected]>
Date: Fri, 21 Aug 2009 11:37:09 -0500
Browsing epics-3.14.10 I came across a typical
lazy-init which is obviously not thread-safe:

from libCom/osi/os/default/osdInterrupt.c:

static epicsMutexId globalLock=0;
static int firstTime = 1;

epicsShareFunc int epicsShareAPI epicsInterruptLock()
{
   if(firstTime) {
       globalLock = epicsMutexMustCreate();
       firstTime = 0;
   }
   epicsMutexMustLock(globalLock);
   return(0);
}


I see this kind of code quite often (and must admit
that I have committed this sort of error myself...)

FWIW
-- Till


Replies:
Re: 2 cents of pedantry Andrew Johnson

Navigate by Date:
Prev: EPICS Base R3.14.11-RC1 Available Andrew Johnson
Next: Re: 2 cents of pedantry Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: EPICS Base R3.14.11-RC1 Available Andrew Johnson
Next: Re: 2 cents of pedantry Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·