Hi Michael,
On 2012-06-08 Michael Davidsaver wrote:
> > Have you looked at the epicsAtomicLock() and epicsAtomicUnlock() routines
> > that Jeff uses in some of his epicsAtomic implementations?
>
> It looks like the current posix implementation uses a global lock
> similar to epicsInterrupt. Do you see a way this could be avoided?
Ahh, that implementation is only used if the compiler does not support the
atomic operations directly, which is not what you want at all. Sorry, I think
I pointed you up completely the wrong tree there.
> My goal for the thread pool implementation is to, as much as possible,
> allow two pools to function independently. Having a global mutex used
> in the queuing and dequeuing processes seems a likely point of contention.
Agreed. We do need a spinlock API in Base, and you are the first person to
publicly propose one, so at the moment you win, although I expect Jeff has
already developed one...
Looking back at your original proposal, I have some naming suggestions:
> struct epicsSL;
> typedef struct epicsSL epicsSL;
typedef struct epicsSpin epicsSpin;
> typedef unsigned long epicsSLFlag;
What actually gets stored in this (why is it a ULong)? Part of me would like
to use the term "key" or maybe "state" instead of "flag", but that depends
what it's actually for.
typedef unsigned long epicsSpinKey;
> #define epicsSLLocalFlag(name) epicsSLFlag name = 0
Not keen, depends on answer above...
> epicsSL* epicsSLCreate()
> void epicsSLDestroy(epicsSL*);
epicsSpin* epicsSpinCreate(void);
void epicsSpinDestroy(epicsSpin*);
> void epicsSLLock(epicsSL*, epicsSLFlag*);
> int epicsSLTryLock(epicsSL*, epicsSLFlag*);
> void epicsSLUnlock(epicsSL*, epicsSLFlag*);
void epicsSpinLock(epicsSpin *, epicsSpinKey *);
int epicsSpinTry(epicsSpin *, epicsSpinKey *);
void epicsSpinUnlock(epicsSpin *, epicsSpinKey *);
We'll talk more on Monday...
- Andrew
--
Never interrupt your enemy when he is making a mistake.
-- Napoleon Bonaparte
- Replies:
- Re: "spinlock" API Michael Davidsaver
- References:
- "spinlock" API Michael Davidsaver
- Re: "spinlock" API Andrew Johnson
- Re: "spinlock" API Michael Davidsaver
- Navigate by Date:
- Prev:
Re: "spinlock" API Michael Davidsaver
- Next:
Re: "spinlock" API Michael Davidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: "spinlock" API Michael Davidsaver
- Next:
Re: "spinlock" API Michael Davidsaver
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|