From fc4a4d902484ac11f2fb02a040a1f53bedc08d34 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 5 Aug 2011 16:23:50 -0600 Subject: [PATCH] o fixed include guard to match file names o fixed legacy vxWorks support --- src/libCom/osi/os/WIN32/epicsAtomicOSD.h | 6 +-- src/libCom/osi/os/default/epicsAtomicOSD.h | 6 +-- src/libCom/osi/os/solaris/epicsAtomicOSD.h | 6 +-- src/libCom/osi/os/vxWorks/epicsAtomicOSD.h | 53 ++++++++++++---------- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/libCom/osi/os/WIN32/epicsAtomicOSD.h b/src/libCom/osi/os/WIN32/epicsAtomicOSD.h index 7ea6385d4..3c4ac85df 100644 --- a/src/libCom/osi/os/WIN32/epicsAtomicOSD.h +++ b/src/libCom/osi/os/WIN32/epicsAtomicOSD.h @@ -13,8 +13,8 @@ * johill@lanl.gov */ -#ifndef osdAtomic_h -#define osdAtomic_h +#ifndef epicsAtomicOSD_h +#define epicsAtomicOSD_h #if defined ( OSD_ATOMIC_INLINE ) @@ -127,4 +127,4 @@ OSD_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) #endif /* if defined ( OSD_ATOMIC_INLINE ) */ -#endif /* ifndef osdAtomic_h */ +#endif /* ifndef epicsAtomicOSD_h */ diff --git a/src/libCom/osi/os/default/epicsAtomicOSD.h b/src/libCom/osi/os/default/epicsAtomicOSD.h index f8033d9d5..0b250495b 100644 --- a/src/libCom/osi/os/default/epicsAtomicOSD.h +++ b/src/libCom/osi/os/default/epicsAtomicOSD.h @@ -13,9 +13,9 @@ * johill@lanl.gov */ -#ifndef osdAtomic -#define osdAtomic +#ifndef epicsAtomicOSD_h +#define epicsAtomicOSD_h #include "epicsAtomicLocked.h" -#endif /* osdAtomic */ +#endif /* epicsAtomicOSD_h */ diff --git a/src/libCom/osi/os/solaris/epicsAtomicOSD.h b/src/libCom/osi/os/solaris/epicsAtomicOSD.h index b2521848d..31359ee14 100644 --- a/src/libCom/osi/os/solaris/epicsAtomicOSD.h +++ b/src/libCom/osi/os/solaris/epicsAtomicOSD.h @@ -13,8 +13,8 @@ * johill@lanl.gov */ -#ifndef osdAtomic_h -#define osdAtomic_h +#ifndef epicsAtomicOSD_h +#define epicsAtomicOSD_h #if defined ( OSD_ATOMIC_INLINE ) @@ -102,4 +102,4 @@ OSD_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) #endif /* if defined ( OSD_ATOMIC_INLINE ) */ -#endif /* osdAtomic_h */ +#endif /* epicsAtomicOSD_h */ diff --git a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h index 8b8abd900..f3e4edaa6 100644 --- a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h +++ b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h @@ -12,12 +12,13 @@ * johill@lanl.gov */ -#ifndef osdAtomic_h -#define osdAtomic_h +#ifndef epicsAtomicOSD_h +#define epicsAtomicOSD_h #if defined ( OSD_ATOMIC_INLINE ) #include "vxWorks.h" /* obtain the version of vxWorks */ +#include "epicsAssert.h" /* * With vxWorks 6.6 and later we need to use vxAtomicLib @@ -30,7 +31,6 @@ #include #include -#include "epicsAssert.h" #ifdef __cplusplus extern "C" { @@ -135,6 +135,7 @@ OSD_ATOMIC_INLINE unsigned epicsAtomicTestAndSetUIntT ( unsigned * pTarget ) #else /* _WRS_VXWORKS_MAJOR * 100 + _WRS_VXWORKS_MINOR >= 606 */ +#include "vxLib.h" #include "intLib.h" #ifdef __cplusplus @@ -143,26 +144,34 @@ extern "C" { OSD_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ) { - /* - * no need for memory barrior since this - * is a single cpu system. - */ - const int key = intLock (); - const size_t result = ++(*pTarget); - intUnlock ( key ); - return result; +# ifdef __m68k__ + return ++(*pTarget); +# else + /* + * no need for memory barrior since this + * is a single cpu system. + */ + const int key = intLock (); + const size_t result = ++(*pTarget); + intUnlock ( key ); + return result; +# endif } OSD_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ) { - /* - * no need for memory barrior since this - * is a single cpu system - */ - const int key = intLock (); - const size_t result = --(*pTarget); - intUnlock ( key ); - return result; +# ifdef __m68k__ + return --(*pTarget); +# else + /* + * no need for memory barrior since this + * is a single cpu system + */ + const int key = intLock (); + const size_t result = --(*pTarget); + intUnlock ( key ); + return result; +#endif } OSD_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newVal ) @@ -195,9 +204,7 @@ OSD_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ) OSD_ATOMIC_INLINE unsigned epicsAtomicTestAndSetUIntT ( unsigned * pTarget ) { STATIC_ASSERT ( sizeof ( int ) == sizeof ( unsigned ) ); - int * const pTarg = ( int * ) ( pTarget ); - const BOOL weSetIt = vxTas ( pTarg, 0, 1 ); - return weSetIt != 0; + return vxTas ( pTarget ); } #ifdef __cplusplus @@ -208,4 +215,4 @@ OSD_ATOMIC_INLINE unsigned epicsAtomicTestAndSetUIntT ( unsigned * pTarget ) #endif /* if defined ( OSD_ATOMIC_INLINE ) */ -#endif /* osdAtomic_h */ +#endif /* epicsAtomicOSD_h */