All,
For the implementation of thread pool I would like to allow it to be
used from interrupt context on RTEMS/vxworks. So it should need to use
epicsInterruptLock(). I want to avoid using a global lock on
Linux/Windows/etc.
Now I could implement this internally for the thread pool only, but I
thought I would float the possibility of creating a proper spin lock
API. Initially RTEMS/vxworks would implement this using epicsInterrupt
and the default implement would use epicsMutex.
Are there any supported OSs other than RTEMS/vxworks which allow a
non-privileged thread/process to avoid being preempted?
This API might look like this.
struct epicsSL;
typedef struct epicsSL epicsSL;
typedef unsigned long epicsSLFlag;
#define epicsSLLocalFlag(name) epicsSLFlag name = 0
epicsSL* epicsSLCreate()
void epicsSLDestroy(epicsSL*);
void epicsSLLock(epicsSL*, epicsSLFlag*);
int epicsSLTryLock(epicsSL*, epicsSLFlag*);
void epicsSLUnlock(epicsSL*, epicsSLFlag*);
Usage would look like:
struct someStruct {
epicsSL *SL;
};
myFunc(someStruct* X) {
epicsSLLocalFlag(iflag);
epicsSLLock(X->SL, &iflag);
... do stuff ...
epicsSLUnlock(X->SL, &iflag);
}
@Andrew, The epicsSL names are just an example.
Michael
https://code.launchpad.net/~epics-core/epics-base/thread-pool/+merge/108385
- Replies:
- Re: "spinlock" API Andrew Johnson
- Navigate by Date:
- Prev:
RE: epicsTimer and rounding Hill, Jeff
- Next:
Re: epicsTimer and rounding Ralph Lange
- 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: epicsTimer and rounding Dirk Zimoch
- Next:
Re: "spinlock" API Andrew Johnson
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|