convert line ends
[canaan.git] / prj / tech / libsrc / sound / mixerlck.h
blob223b66c0f8b648a34e30cef4a66d13dbba0dd899
1 ///////////////////////////////////////////////////////////////////////////////
2 // $Source: x:/prj/tech/libsrc/sound/RCS/mixerlck.h $
3 // $Author: dc $
4 // $Date: 1997/11/10 10:28:05 $
5 // $Revision: 1.1 $
6 //
7 // Tools for thread synchronization and management.
8 //
9 //
11 #ifndef __MIXERLCK_H
12 #define __MIXERLCK_H
14 #ifdef _WIN32
16 ///////////////////////////////////////////////////////////////////////////////
18 // CLASS: cMixerAutoLock
20 // a threadMutex autolock for the mixer
21 // really could just be cMutexAutoLock, but hey
24 class cMixerAutoLock
26 public:
27 cMixerAutoLock(cThreadMutex & mutex);
28 ~cMixerAutoLock();
30 private:
31 cThreadMutex & m_mutex;
33 // make copy constructor and assignment operator inaccessible
34 cMixerAutoLock(const cMixerAutoLock &);
35 cMixerAutoLock &operator=(const cMixerAutoLock &);
38 //////////////////////////////////////
40 // CLASS: cMixerAutoLock
43 inline
44 cMixerAutoLock::cMixerAutoLock(cThreadMutex & mutex)
45 : m_mutex(mutex)
47 #ifndef SHIP
48 DWORD hr=m_mutex.Wait();
49 switch (hr)
51 case WAIT_TIMEOUT:
52 case WAIT_ABANDONED:
53 CriticalMsg("AutoLock of Mutex Wait Infinite Timeout or Abandon");
54 break;
55 case WAIT_OBJECT_0:
56 break;
58 #else
59 m_mutex.Wait();
60 #endif
63 ///////////////////////////////////////
65 inline
66 cMixerAutoLock::~cMixerAutoLock()
68 m_mutex.Release();
71 #endif // _WIN32
73 #endif /* !__MIXERLCK_H */