EPICS Home

Experimental Physics and Industrial Control System


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

Subject: RFC: libCom/osi - new spinlock API
From: Ralph Lange <[email protected]>
To: EPICS Core Talk <[email protected]>
Date: Wed, 17 Oct 2012 16:42:50 -0400
All,

based on a recent thread on core-talk [1], the current proposal for a spinlock API to be put into libCom/osi looks like this:


typedef struct epicsSpin *epicsSpinId;
typedef unsigned long epicsSpinKey;

epicsShareFunc epicsSpinId epicsSpinCreate();
epicsShareFunc void epicsSpinDestroy(epicsSpinId);

epicsShareFunc void epicsSpinLock(epicsSpinId, epicsSpinKey*);
epicsShareFunc int epicsSpinTryLock(epicsSpinId, epicsSpinKey*);
epicsShareFunc void epicsSpinUnlock(epicsSpinId, epicsSpinKey*);


These are intended to allow for granular locking, and to be safe to use from an ISR (when applicable).

The implementation would be based on:
vxWorks - single core: intLock()
vxWorks - multi core: ISR-callable spinlocks
RTEMS: pthread_spin_lock() (or SuperCore spinlocks?)
Posix: pthread_spin_lock() (if implemented, else epicsMutex)
Default: epicsMutex

The epicsSpinKey is used for implementations that need to persist a piece of status data between lock and unlock calls, e.g. intLock().

At the same time the existing epicsInterruptLock() API would be deprecated.

Comments are very welcome.

Thanks,
~Ralph

[1] http://www.aps.anl.gov/epics/core-talk/2012/msg00035.php


Replies:
Re: RFC: libCom/osi - new spinlock API Andrew Johnson

Navigate by Date:
Prev: [Merge] lp:~jlmuir/epics-base/caput-help-F-opt-3.15 into lp:epics-base noreply
Next: Re: RFC: libCom/osi - new spinlock API Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: [Merge] lp:~jlmuir/epics-base/caput-help-F-opt-3.15 into lp:epics-base noreply
Next: Re: RFC: libCom/osi - new spinlock API Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024