use location exception

This commit is contained in:
Jeff Hill
2000-02-29 23:39:02 +00:00
parent 5bfbd4c2e7
commit f8245e69c2
2 changed files with 14 additions and 44 deletions

View File

@@ -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;
}
}

View File

@@ -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
}
}