EPICS Base  7.0.8.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
epicsSpin.h File Reference

OS independent interface for creating spin locks. More...

#include "libComAPI.h"
Include dependency graph for epicsSpin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct epicsSpin * epicsSpinId
 

Functions

LIBCOM_API epicsSpinId epicsSpinCreate (void)
 Creates a spin lock. More...
 
LIBCOM_API epicsSpinId epicsSpinMustCreate (void)
 Creates a spin lock. More...
 
LIBCOM_API void epicsSpinDestroy (epicsSpinId lockId)
 Destroys spin lock. More...
 
LIBCOM_API void epicsSpinLock (epicsSpinId lockId)
 Acquires the spin lock. More...
 
LIBCOM_API int epicsSpinTryLock (epicsSpinId lockId)
 Tries to acquire the spin lock. More...
 
LIBCOM_API void epicsSpinUnlock (epicsSpinId lockId)
 Releases spin lock. More...
 

Detailed Description

OS independent interface for creating spin locks. Implemented using the OS-specific spinlock interface if available. Otherwise uses epicsMutexLock.

Definition in file epicsSpin.h.

Typedef Documentation

typedef struct epicsSpin* epicsSpinId

Handle to spin lock

Definition at line 29 of file epicsSpin.h.

Function Documentation

LIBCOM_API epicsSpinId epicsSpinCreate ( void  )

Creates a spin lock

Returns
Handle to spinlock or NULL if failed to create the lock
LIBCOM_API epicsSpinId epicsSpinMustCreate ( void  )

Creates a spin lock. Calls cantProceed() if unable to create lock

LIBCOM_API void epicsSpinDestroy ( epicsSpinId  lockId)

Destroys the spin lock

Parameters
lockIdidentifies the spinlock
LIBCOM_API void epicsSpinLock ( epicsSpinId  lockId)

Acquires the lock. Blocks if lock is unavailable

Parameters
lockIdidentifies the spinlock
LIBCOM_API int epicsSpinTryLock ( epicsSpinId  lockId)

Tries to acquire the lock. If failed, return immediately with non-zero error code.

Parameters
lockIdidentifies the spinlock
Returns
0 if lock was acquired. 1 if failed because acquired by another thread. Otherwise returns non-zero OS specific return code if failed for any other reason
LIBCOM_API void epicsSpinUnlock ( epicsSpinId  lockId)

Releases spin lock

Parameters
lockIdidentifies the spinlock