removed inline functions from dll interface class
This commit is contained in:
@@ -127,8 +127,7 @@ void epicsShareAPI epicsMutexShowAll(int onlyLocked,unsigned int level)
|
||||
epicsMutexUnlock(epicsMutexGlobalLock);
|
||||
}
|
||||
|
||||
|
||||
epicsMutex :: epicsMutex () throw ( std::bad_alloc ) :
|
||||
epicsMutex :: epicsMutex () epics_throws (( std::bad_alloc )) :
|
||||
id ( epicsMutexCreate () )
|
||||
{
|
||||
if ( this->id == 0 ) {
|
||||
@@ -137,20 +136,62 @@ epicsMutex :: epicsMutex () throw ( std::bad_alloc ) :
|
||||
}
|
||||
|
||||
epicsMutex ::~epicsMutex ()
|
||||
throw ()
|
||||
epics_throws (())
|
||||
{
|
||||
epicsMutexDestroy ( this->id );
|
||||
}
|
||||
|
||||
void epicsMutex::lock ()
|
||||
epics_throws (( invalidSemaphore ))
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexLock ( this->id );
|
||||
if ( status != epicsMutexLockOK ) {
|
||||
throw invalidSemaphore ();
|
||||
}
|
||||
}
|
||||
|
||||
bool epicsMutex::lock ( double timeOut ) // X aCC 361
|
||||
epics_throws (( invalidSemaphore ))
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexLockWithTimeout ( this->id, timeOut );
|
||||
if ( status == epicsMutexLockOK ) {
|
||||
return true;
|
||||
}
|
||||
else if ( status == epicsMutexLockTimeout ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw invalidSemaphore ();
|
||||
return false; // never here, compiler is happy
|
||||
}
|
||||
}
|
||||
|
||||
bool epicsMutex::tryLock () // X aCC 361
|
||||
epics_throws (( invalidSemaphore ))
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexTryLock ( this->id );
|
||||
if ( status == epicsMutexLockOK ) {
|
||||
return true;
|
||||
}
|
||||
else if ( status == epicsMutexLockTimeout ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw invalidSemaphore ();
|
||||
return false; // never here, but compiler is happy
|
||||
}
|
||||
}
|
||||
|
||||
void epicsMutex::unlock ()
|
||||
epics_throws (())
|
||||
{
|
||||
epicsMutexUnlock ( this->id );
|
||||
}
|
||||
|
||||
void epicsMutex :: show ( unsigned level ) const
|
||||
throw ()
|
||||
epics_throws (())
|
||||
{
|
||||
epicsMutexShow ( this->id, level );
|
||||
}
|
||||
|
||||
void epicsMutex :: throwInvalidSemaphore ()
|
||||
throw ( epicsMutex::invalidSemaphore )
|
||||
{
|
||||
throw invalidSemaphore ();
|
||||
}
|
||||
|
||||
|
||||
+22
-66
@@ -10,8 +10,18 @@
|
||||
#ifndef epicsMutexh
|
||||
#define epicsMutexh
|
||||
|
||||
#if 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <new>
|
||||
# include <stdexcept>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "epicsAssert.h"
|
||||
|
||||
#endif
|
||||
|
||||
#include "shareLib.h"
|
||||
|
||||
typedef struct epicsMutexOSD *epicsMutexId;
|
||||
@@ -21,30 +31,27 @@ typedef enum {
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <new>
|
||||
#include <stdexcept>
|
||||
#include "cxxCompilerDependencies.h"
|
||||
|
||||
class epicsMutex {
|
||||
class epicsShareClass epicsMutex {
|
||||
public:
|
||||
class invalidSemaphore {}; // exception
|
||||
epicsShareFunc epicsMutex ()
|
||||
throw ( std::bad_alloc );
|
||||
epicsShareFunc ~epicsMutex ()
|
||||
throw ();
|
||||
epicsShareFunc void show ( unsigned level ) const
|
||||
throw ();
|
||||
epicsMutex ()
|
||||
epics_throws (( std::bad_alloc ));
|
||||
~epicsMutex ()
|
||||
epics_throws (());
|
||||
void show ( unsigned level ) const
|
||||
epics_throws (());
|
||||
void lock () /* blocks until success */
|
||||
throw ( invalidSemaphore );
|
||||
epics_throws (( invalidSemaphore ));
|
||||
void unlock ()
|
||||
throw ();
|
||||
epics_throws (());
|
||||
bool lock ( double timeOut ) /* true if successful */
|
||||
throw ( invalidSemaphore );
|
||||
epics_throws (( invalidSemaphore ));
|
||||
bool tryLock () /* true if successful */
|
||||
throw ( invalidSemaphore );
|
||||
epics_throws (( invalidSemaphore ));
|
||||
private:
|
||||
epicsMutexId id;
|
||||
epicsShareFunc static void throwInvalidSemaphore ()
|
||||
throw ( invalidSemaphore );
|
||||
epicsMutex ( const epicsMutex & );
|
||||
epicsMutex & operator = ( const epicsMutex & );
|
||||
};
|
||||
@@ -89,55 +96,4 @@ epicsShareFunc void epicsShareAPI epicsMutexShowAll(
|
||||
|
||||
#include "osdMutex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline void epicsMutex::lock ()
|
||||
throw ( epicsMutex::invalidSemaphore )
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexLock ( this->id );
|
||||
if ( status != epicsMutexLockOK ) {
|
||||
epicsMutex::throwInvalidSemaphore ();
|
||||
}
|
||||
}
|
||||
|
||||
inline bool epicsMutex::lock ( double timeOut ) // X aCC 361
|
||||
throw ( epicsMutex::invalidSemaphore )
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexLockWithTimeout ( this->id, timeOut );
|
||||
if ( status == epicsMutexLockOK ) {
|
||||
return true;
|
||||
}
|
||||
else if ( status == epicsMutexLockTimeout ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
epicsMutex::throwInvalidSemaphore ();
|
||||
return false; // never here, compiler is happy
|
||||
}
|
||||
}
|
||||
|
||||
inline bool epicsMutex::tryLock () // X aCC 361
|
||||
throw ( epicsMutex::invalidSemaphore )
|
||||
{
|
||||
epicsMutexLockStatus status = epicsMutexTryLock ( this->id );
|
||||
if ( status == epicsMutexLockOK ) {
|
||||
return true;
|
||||
}
|
||||
else if ( status == epicsMutexLockTimeout ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
epicsMutex::throwInvalidSemaphore ();
|
||||
return false; // never here, but compiler is happy
|
||||
}
|
||||
}
|
||||
|
||||
inline void epicsMutex::unlock ()
|
||||
throw ()
|
||||
{
|
||||
epicsMutexUnlock ( this->id );
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* epicsMutexh */
|
||||
|
||||
Reference in New Issue
Block a user