Final spinlock tidying-up
* Abort epicsSpinTest() if epicsSpinCreate() returns NULL * Adjust RELEASE_NOTES that describe the implementations.
This commit is contained in:
@@ -117,12 +117,13 @@ The basic rules which device support must follow are:</p>
|
||||
<p>The new header file epicsSpin.h adds a portable spin-locks API which is
|
||||
intended for locking very short sections of code (typically one or two lines of
|
||||
C or C++) to provide a critical section that protects against race conditions.
|
||||
On Posix platforms this uses the pthread_spinlock_t type if it's available but
|
||||
falls back to a pthread_mutex_t if not; on the UP VxWorks and RTEMS platforms
|
||||
the implementations lock out the CPU interrupts; the default implementation
|
||||
(used where no better implementation is available for the platform) uses an
|
||||
epicsMutex. Spin-locks may not be taken recursively, and the code inside the
|
||||
critical section should always be short and deterministic.</p>
|
||||
On Posix platforms this uses the pthread_spinlock_t type if it's available and
|
||||
the build is not configured to use Posix thread priorities, but otherwise it
|
||||
falls back to a pthread_mutex_t. On the UP VxWorks and RTEMS platforms the
|
||||
implementations lock out CPU interrupts and disable task preemption while a
|
||||
spin-lock is held. The default implementation (used when no other implementation
|
||||
is provided) uses an epicsMutex. Spin-locks may not be taken recursively, and
|
||||
the code inside the critical section should be short and deterministic.</p>
|
||||
|
||||
<h3>Improvements to aToIPAddr()</h3>
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ void epicsSpinPerformance ()
|
||||
|
||||
/* Initialize spinlock */
|
||||
spin = epicsSpinCreate();
|
||||
if (!spin)
|
||||
testAbort("epicsSpinCreate() returned NULL");
|
||||
|
||||
/* test a single lock pair */
|
||||
epicsTimeGetCurrent(&begin);
|
||||
@@ -126,7 +128,7 @@ static void verifyTryLock()
|
||||
{
|
||||
struct verifyTryLock verify;
|
||||
|
||||
verify.spin = epicsSpinCreate();
|
||||
verify.spin = epicsSpinMustCreate();
|
||||
verify.done = epicsEventMustCreate(epicsEventEmpty);
|
||||
|
||||
testOk1(epicsSpinTryLock(verify.spin) == 0);
|
||||
@@ -159,6 +161,8 @@ MAIN(epicsSpinTest)
|
||||
verifyTryLock();
|
||||
|
||||
spin = epicsSpinCreate();
|
||||
if (!spin)
|
||||
testAbort("epicsSpinCreate() returned NULL");
|
||||
|
||||
id = (epicsThreadId *) calloc(nthreads, sizeof(epicsThreadId));
|
||||
name = (char **) calloc(nthreads, sizeof(char *));
|
||||
|
||||
Reference in New Issue
Block a user