#include <MonitorException.h>
class CMonitorException {MonitorException(int correctOwner, int actualOwner, const char* file, const char* line);
MonitorException(const MonitorException& rhs);
virtual ~MonitorException();
MonitorException& operator=(const MonitorException& rhs);
const int operator==(const MonitorException& rhs);
const int operator!=(const MonitorException& rhs);
virtual const const char* ReasonText();
virtual const Int_t ReasonCode();
}
The NSCL DAQ base software includes support for an object model wrapped around the pthreads threading subsystem. This allows NSCL DAQ software to be written that can take advantage of multiple threads of execution. The threading library is described in the chapter; NSCL DAQ Thread Library. That chapter points to additional reference pages that provide reference information for the classes themselves.
Any non-trivial threaded application must synchronize at critical
points in its operation in order to maintain consistent views of
non-primitive data. The NSCL DAQ thread library provides a
Synchronizable
class and associated
SyncGuard
class to support this synchronization.
These classes attempt to detect abuse of the synchronization model
they support. The report such abuse by throwing
CMonitorException
objects.
CMonitorException
is derived from the
CException
class, and therefore supports and implements all of its
virtual members.
Constructors.
In the description of the methods below;
correctOwner
is a thread id that represents the thread that should be
holding ownership of a synchronizable object.
actualOwner
is the thread id of the thread that actually does own the
object, and file
and line
are ordinarily the values of the
__FILE__
and
__LINE__
macros at the time the the exception is constructed.
MonitorException(int correctOwner, int actualOwner, const char* file, const char* line);
The normal constructor for this object. The exception will report that the ownership of the synchronizable object should have been the currently executing thread but was a different thread.
MonitorException(const MonitorException& rhs);
Copy construction. The object constructed will be a duplcate
of the rhs
object.
Canonical methods.
The
CMonitorException
class supports assignment,
equality comparison and inequality comparison. Assignment
creates a duplicate of the right hand side of the assignment
operator. Two
CMonitorException
objects are equal if
the Reason text they would generate are equal. Inequality is
defined as the logical inverse of equality.
Implementation of the CException
interface.
virtual const const char* ReasonText();
Returns the reason for the exception. This is intended to be human readable text that describes the error as well as where an why it was thrown.
virtual const Int_t ReasonCode();
Normally this returns an error code that can be processed by computer code. At present, there's only one reason for the exception to be thrown, so this always returns -1.