EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: lock ownership enforcement in OO design
From: "Jeff Hill" <[email protected]>
To: "'EPICS core-talk'" <[email protected]>
Date: Fri, 1 Jun 2007 14:41:30 -0600

All,

 

To enforce mutex lock ownership, and allow lock overhead consolidation in complex designs, currently many of my classes look like this.

 

class Fred {

public:

            Fred ( epicsMutex & mutex ) : _mutex ( mutex ) {}

            Void doIt ( epicsGuard < epicsMutex > & guard, … ) { guard.assertIdenticalMutex ( _mutex ); }

private:

            epicsMutex & _mutex;

};

 

I am considering this alternative.

 

class Fred {

public:

            Fred ( epicsMutex & mutex ) : _mutex ( mutex ) {}

            Void doIt ( … ) { _mutex.assertOwnership (); }

private:

            epicsMutex & _mutex;

};

 

Negatives: runtime instead of compile time detection

Positives: Interfaces are simpler to look at, and more efficient too (no passing of guard references)

Neutral: With both approaches its much more obvious (compared to no enforcement) that lock hierarchies are inverted when independently developed codes call callbacks against each other. We can also remove detection logic from optimized builds.

 

Andrew has also suggested macros that eliminate guard argument passing from optimized builds as a 3rd alternative.

 

Wadayathink?

 

Jeff
______________________________________________________
Jeffrey O. Hill           Internet     [email protected]
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

 


Replies:
Re: lock ownership enforcement in OO design Eric Norum
Re: lock ownership enforcement in OO design Kay-Uwe Kasemir

Navigate by Date:
Prev: Howto set or read one value of a waveform record Touchard Dominique
Next: Re: lock ownership enforcement in OO design Eric Norum
Index: 2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Howto set or read one value of a waveform record Touchard Dominique
Next: Re: lock ownership enforcement in OO design Eric Norum
Index: 2002  2003  2004  2005  2006  <20072008  2009  2010  2011  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 ·