28 #if defined(DONT_USE_POSIX_THREAD_PRIORITY_SCHEDULING) 29 #if defined(_POSIX_SPIN_LOCKS) && (_POSIX_SPIN_LOCKS > 0) 34 #define checkStatus(status,message) \ 36 errlogPrintf("epicsSpin %s failed: error %s\n", \ 37 (message), strerror((status))); \ 47 pthread_spinlock_t
lock;
54 spin = calloc(1,
sizeof(*spin));
58 status = pthread_spin_init(&spin->
lock, PTHREAD_PROCESS_PRIVATE);
73 status = pthread_spin_destroy(&spin->
lock);
82 status = pthread_spin_lock(&spin->
lock);
91 status = pthread_spin_trylock(&spin->
lock);
101 status = pthread_spin_unlock(&spin->
lock);
119 spin = calloc(1,
sizeof(*spin));
123 status = pthread_mutex_init(&spin->
lock,
NULL);
138 status = pthread_mutex_destroy(&spin->
lock);
147 status = pthread_mutex_lock(&spin->
lock);
156 status = pthread_mutex_trylock(&spin->
lock);
166 status = pthread_mutex_unlock(&spin->
lock);
177 cantProceed(
"epicsSpinMustCreate: epicsSpinCreate failed.");
void epicsSpinLock(epicsSpinId spin)
int epicsSpinTryLock(epicsSpinId spin)
void epicsSpinDestroy(epicsSpinId spin)
void epicsSpinUnlock(epicsSpinId spin)
LIBCOM_API void cantProceed(const char *msg,...)
Routines for code that can't continue or return after an error.
epicsSpinId epicsSpinMustCreate(void)
#define checkStatus(status, message)
epicsSpinId epicsSpinCreate(void)
struct epicsSpin epicsSpin