Final spinlock tidying-up

* Abort epicsSpinTest() if epicsSpinCreate() returns NULL
* Adjust RELEASE_NOTES that describe the implementations.
This commit is contained in:
Andrew Johnson
2014-07-24 16:33:35 -05:00
parent 87a6688c17
commit 9b6e270b97
2 changed files with 12 additions and 7 deletions
+7 -6
View File
@@ -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>
+5 -1
View File
@@ -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 *));