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: Re: "spinlock" API
From: Michael Davidsaver <[email protected]>
To: Andrew Johnson <[email protected]>
Cc: [email protected]
Date: Mon, 11 Jun 2012 10:58:26 -0400
On 6/8/2012 7:14 PM, Andrew Johnson wrote:
...
typedef unsigned long epicsSLFlag;
What actually gets stored in this (why is it a ULong)?

The purpose is the same as the return value of epicsInterruptLock. It is an opaque piece of data which is passed from the lock() call to the unlock() call. I believe this has been used as a mask to indicate which interrupts are disabled.

I used 'unsigned long' in the example, but the formal specification would be:

typedef <unspecified> epicsSpinKey;


I'm not too concerned about this as there is evidence that 'unsigned long' would be sufficient are currently support architectures..

http://lxr.linux.no/#linux+v3.4.2/include/linux/spinlock_api_smp.h#L157

  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;

Ok.

#define epicsSLLocalFlag(name) epicsSLFlag name = 0
Not keen, depends on answer above...

The only use of this type is as a function local variable. This is an attempt to make this case more convenient. The zero assignment is meant to avoid compiler warnings about using of an uninitialized variable when passing the pointer to the lock() function.


Michael


Replies:
Re: "spinlock" API Andrew Johnson
References:
"spinlock" API Michael Davidsaver
Re: "spinlock" API Andrew Johnson
Re: "spinlock" API Michael Davidsaver
Re: "spinlock" API Andrew Johnson

Navigate by Date:
Prev: Re: "spinlock" API Andrew Johnson
Next: Re: "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: Re: "spinlock" API Andrew Johnson
Next: Re: "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