49 #if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
50 #include <CoreAudio/CoreAudioTypes.h>
52 #include <CoreAudioTypes.h>
60 #error Unsupported operating system
71 CAMutex(
const char* inName);
77 virtual void Unlock();
78 virtual bool Try(
bool& outWasLocked);
80 virtual bool IsFree()
const;
81 virtual bool IsOwnedByCurrentThread()
const;
88 pthread_mutex_t mMutex;
101 Locker(CAMutex& inMutex) : mMutex(inMutex), mNeedsRelease(false) { mNeedsRelease = mMutex.Lock(); }
102 ~Locker() {
if(mNeedsRelease) { mMutex.Unlock(); } }
105 Locker(
const Locker&);
106 Locker& operator=(
const Locker&);
120 Tryer (CAMutex &mutex) : mMutex(mutex), mNeedsRelease(false), mHasLock(false) { mHasLock = mMutex.Try (mNeedsRelease); }
121 ~Tryer () {
if (mNeedsRelease) mMutex.Unlock(); }
123 bool HasLock ()
const {
return mHasLock; }
127 Tryer& operator=(
const Tryer&);
138 #endif // __CAMutex_h__