24 #define WIN32_LEAN_AND_MEAN
39 virtual int svc() = 0;
45 thread_ = CreateThread(NULL, 0, ThreadProc,
this, 0, &
id);
47 pthread_create(&thread_, NULL, ThreadProc,
this);
55 WaitForSingleObject(thread_, INFINITE);
57 pthread_join(thread_, NULL);
79 ThreadProc(
void* param)
83 return pThrObj->
svc();
100 InitializeCriticalSection(&lock_);
102 pthread_mutexattr_t a;
103 pthread_mutexattr_init(&a);
104 pthread_mutexattr_settype(&a, PTHREAD_MUTEX_RECURSIVE);
105 pthread_mutex_init(&lock_, &a);
106 pthread_mutexattr_destroy(&a);
113 DeleteCriticalSection(&lock_);
115 pthread_mutex_destroy(&lock_);
122 EnterCriticalSection(&lock_);
124 pthread_mutex_lock(&lock_);
131 LeaveCriticalSection(&lock_);
133 pthread_mutex_unlock(&lock_);
164 bool isLocked() {
return lock_ == 0 ? false :
true;}
Base class for threads in MM devices.
Definition DeviceThreads.h:34
virtual ~MMDeviceThreadBase()
Definition DeviceThreads.h:37
void wait()
Definition DeviceThreads.h:52
virtual int activate()
Definition DeviceThreads.h:41
MMDeviceThreadBase()
Definition DeviceThreads.h:36
Definition DeviceThreads.h:151
MMThreadGuard(MMThreadLock *lock)
Definition DeviceThreads.h:158
bool isLocked()
Definition DeviceThreads.h:164
MMThreadGuard(MMThreadLock &lock)
Definition DeviceThreads.h:153
~MMThreadGuard()
Definition DeviceThreads.h:166
Critical section lock.
Definition DeviceThreads.h:95
void Lock()
Definition DeviceThreads.h:119
~MMThreadLock()
Definition DeviceThreads.h:110
void Unlock()
Definition DeviceThreads.h:128
MMThreadLock()
Definition DeviceThreads.h:97