diff --git a/src/libCom/osi/osiEvent.h b/src/libCom/osi/osiEvent.h index 3c6021437..e28649420 100644 --- a/src/libCom/osi/osiEvent.h +++ b/src/libCom/osi/osiEvent.h @@ -10,6 +10,7 @@ #ifndef osiEventh #define osiEventh +#include "locationException.h" #include "osiSem.h" #include "shareLib.h" @@ -33,11 +34,7 @@ inline osiEvent::osiEvent () { this->id = semBinaryCreate (semEmpty); if (this->id==0) { -# ifdef noExceptionsFromCXX - assert (0); -# else - throw noMemory (); -# endif + throwWithLocation ( noMemory () ); } } @@ -56,11 +53,7 @@ inline void osiEvent::wait () semTakeStatus status; status = semBinaryTake (this->id); if (status!=semTakeOK) { -# ifdef noExceptionsFromCXX - assert (0); -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); } } @@ -75,12 +68,8 @@ inline bool osiEvent::wait (double timeOut) return false; } else { -# ifdef noExceptionsFromCXX - assert (0); - return false; -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); + return false; } } @@ -95,12 +84,8 @@ inline bool osiEvent::tryWait () return false; } else { -# ifdef noExceptionsFromCXX - assert (0); - return false; -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); + return false; } } diff --git a/src/libCom/osi/osiMutex.h b/src/libCom/osi/osiMutex.h index 0797f1ecb..737b9e4fb 100644 --- a/src/libCom/osi/osiMutex.h +++ b/src/libCom/osi/osiMutex.h @@ -10,6 +10,7 @@ #ifndef osiMutexh #define osiMutexh +#include "locationException.h" #include "osiSem.h" #include "shareLib.h" @@ -33,11 +34,7 @@ inline osiMutex::osiMutex () { this->id = semMutexCreate (); if (this->id==0) { -# ifdef noExceptionsFromCXX - assert (0); -# else - throw noMemory (); -# endif + throwWithLocation ( noMemory () ); } } @@ -51,11 +48,7 @@ inline void osiMutex::lock () const semTakeStatus status; status = semMutexTake (this->id); if (status!=semTakeOK) { -# ifdef noExceptionsFromCXX - assert (0); -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); } } @@ -70,12 +63,8 @@ inline bool osiMutex::lock (double timeOut) const return false; } else { -# ifdef noExceptionsFromCXX - assert (0); - return false; -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); + return false; // never here, compiler is happy } } @@ -90,12 +79,8 @@ inline bool osiMutex::tryLock () const return false; } else { -# ifdef noExceptionsFromCXX - assert (0); - return false; -# else - throw invalidSemaphore (); -# endif + throwWithLocation ( invalidSemaphore () ); + return false; // never here, but compiler is happy } }