fixed issues in posix and vxWorks specific epicsAtomic found during testing
This commit is contained in:
committed by
Andrew Johnson
parent
8a8ba04405
commit
e8154577db
@@ -51,4 +51,5 @@ namespace {
|
||||
};
|
||||
} // end of anonymous namespace
|
||||
|
||||
#endif // ifndef epicsAtomicGuard_h
|
||||
#endif // ifndef epicsAtomicGuard_h
|
||||
|
||||
|
||||
@@ -24,9 +24,12 @@
|
||||
* than pthread_once.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "epicsAssert.h"
|
||||
#include "epicsAtomic.h"
|
||||
|
||||
// If we have an inline implementation then implement
|
||||
@@ -39,11 +42,12 @@
|
||||
namespace {
|
||||
|
||||
// a statically initialized mutex doesnt need to be destroyed
|
||||
static pthread_mutex_t AtomicGuard :: mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
inline AtomicGuard :: AtomicGuard () throw ()
|
||||
{
|
||||
unsigned countDown = 1000u;
|
||||
int status;
|
||||
while ( true ) {
|
||||
status = pthread_mutex_lock ( & mutex );
|
||||
if ( status != EINTR ) break;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "vxWorks.h" /* obtain the version of vxWorks */
|
||||
#include "epicsAssert.h"
|
||||
|
||||
#define OSD_ATOMIC_INLINE_DEFINITION
|
||||
|
||||
/*
|
||||
* With vxWorks 6.6 and later we need to use vxAtomicLib
|
||||
* to implement this functionality correctly on SMP systems
|
||||
@@ -29,8 +31,6 @@
|
||||
#include <limits.h>
|
||||
#include <vxAtomicLib.h>
|
||||
|
||||
#define OSD_ATOMIC_INLINE_DEFINITION
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Reference in New Issue
Block a user