OMProtected class

OMProtected is the base class for protected objects. It embodies a mutex and lock and unlock methods that are automatically embedded within a concrete public method defined for the object.

This class is declared in the file omprotected.h.

Construction summary
OMProtected
Constructs an OMProtected object
~OMProtected
Destroys the OMProtected object
Macro summary
Aggregates OMProtected objects inside guarded classes instead of inheriting from OMProtected.
Method summary
deleteMutex
Deletes the mutex and sets its value to NULL.
free
Is provided for backward compatibility. It calls the unlock method.
getGuard
Gets the guard object.
initializeMutex
Creates an RTOS mutex, if it has not been created already.
lock
Locks the mutex of the OMProtected object.
unlock
Unlocks the mutex of the OMProtected object.
Macros

OMDECLARE_GUARDED

Aggregates OMProtected objects inside guarded classes instead of inheriting from OMProtected. It is defined as follows:

#define OMDECLARE_GUARDED

public:
inline void lock() const {m_omGuard.lock();}
inline void unlock() const {m_omGuard.unlock();}
inline const OMProtected& getGuard() const
{return m_omGuard;}
private:
OmProtected m_omGuard;


Feedback