diff options
Diffstat (limited to 'XMPCommon/Interfaces/ISharedMutex.h')
-rw-r--r-- | XMPCommon/Interfaces/ISharedMutex.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/XMPCommon/Interfaces/ISharedMutex.h b/XMPCommon/Interfaces/ISharedMutex.h new file mode 100644 index 0000000..6543fba --- /dev/null +++ b/XMPCommon/Interfaces/ISharedMutex.h @@ -0,0 +1,88 @@ +#ifndef ISharedMutex_h__ +#define ISharedMutex_h__ 1 + +// ================================================================================================= +// ADOBE SYSTEMS INCORPORATED +// Copyright 2015 Adobe Systems Incorporated +// All Rights Reserved +// +// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms +// of the Adobe license agreement accompanying it. +// ================================================================================================= + +#include "XMPCommon/XMPCommonFwdDeclarations_I.h" +#include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject_I.h" +#include "XMPCommon/XMPCommonErrorCodes_I.h" + +namespace XMP_COMPONENT_INT_NAMESPACE { + + //! + //! Internal interface that represents a mutex object. + //! \details Provides all the functions to lock/unlock the mutex. + //! + class XMP_PUBLIC ISharedMutex + : public virtual ISharedObject + { + public: + //! + //! Locks the mutex in exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL Lock() __NOTHROW__ = 0; + + //! + //! Tries to lock the mutex in exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL TryLock() __NOTHROW__ = 0; + + //! + //! Unlocks the mutex in exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL Unlock() __NOTHROW__ = 0; + + //! + //! Locks the mutex in non exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL LockShared() __NOTHROW__ = 0; + + //! + //! Tries to lock the mutex in non exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL TryLockShared() __NOTHROW__ = 0; + + //! + //! Unlocks the mutex in non exclusive mode. + //! \return a value of type eMutexErrorCode indicating the status of operation. + //! + virtual eMultiThreadingErrorCode APICALL UnlockShared() __NOTHROW__ = 0; + + // factory methods + //! + //! Creates a mutex. + //! \return a shared pointer to #ISharedMutex. + //! + static spISharedMutex CreateSharedMutex(); + + protected: + //! + //! Destructor + //! + virtual ~ISharedMutex() __NOTHROW__ {} + + //! \cond XMP_INTERNAL_DOCUMENTATION + + #ifdef FRIEND_CLASS_DECLARATION + FRIEND_CLASS_DECLARATION(); + #endif + REQ_FRIEND_CLASS_DECLARATION(); + //! \endcond + + }; +} + +#endif // ISharedMutex_h__ + |