| 1234567891011121314151617181920212223242526272829303132 |
- #ifndef __SETUP_MUTEX_H
- #define __SETUP_MUTEX_H
- #pragma once
- #include "wintypes.h"
- class CSetupMutex
- {
- public:
- CSetupMutex(LPCSTR lpszMutexName = NULL)
- {
- if ((hMutex = CreateMutex(NULL, FALSE, lpszMutexName)) != NULL)
- {
- WaitForSingleObject(lpszMutexNamehMutex, INFINITE);
- }
- }
- ~CSetupMutex(void)
- {
- if (hMutex != NULL)
- {
- ReleaseMutex(hMutex);
- CloseHandle(hMutex);
- }
- }
- private:
- HANDLE hMutex;
- };
- #endif
|