00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "stdafx.h"
00037 #include "OSManager.h"
00038
00039 #include "Win32CriticalSection.h"
00040 #include "Win32Thread.h"
00041 #include "Win32Semaphore.h"
00042 #include "Win32Mutex.h"
00043 #include "Win32Event.h"
00044 #include "Win32ReadWriteLock.h"
00045
00046 #ifdef _MEMORY_DEBUG
00047 #define new DEBUG_NEW
00048 #define malloc DEBUG_MALLOC
00049 static char THIS_FILE[] = __FILE__;
00050 #endif
00051
00052 KOMODIA_NAMESPACE_START
00053
00054 COSManager::COSManager()
00055 {
00056 }
00057
00058 COSManager::~COSManager()
00059 {
00060 }
00061
00062 CGenericEvent* COSManager::CreateEvent(BOOL bInitialState,
00063 BOOL bManualReset,
00064 const char* pEventName,
00065 LPVOID lpSecurity)
00066 {
00067 #ifdef WIN32
00068 return new CWin32Event(bInitialState,
00069 bManualReset,
00070 pEventName,
00071 lpSecurity);
00072 #else
00073 return NULL;
00074 #endif
00075 }
00076
00077 CGenericCriticalSection* COSManager::CreateCriticalSection()
00078 {
00079 #ifdef WIN32
00080 return new CWin32CriticalSection;
00081 #else
00082 return NULL;
00083 #endif
00084 }
00085
00086 CGenericThread* COSManager::CreateThread(CGenericThread::LPGenericThreadProc pThreadProc)
00087 {
00088 #ifdef WIN32
00089 return new CWin32Thread(pThreadProc);
00090 #else
00091 return NULL;
00092 #endif
00093 }
00094
00095 CGenericSemaphore* COSManager::CreateSemaphore(long lInitialCount,
00096 long lMaxCount,
00097 const char* pSemaphoreName)
00098 {
00099 #ifdef WIN32
00100 return new CWin32Semaphore(lInitialCount,
00101 lMaxCount,
00102 pSemaphoreName);
00103 #else
00104 return NULL;
00105 #endif
00106 }
00107
00108 CGenericMutex* COSManager::CreateMutex(const char* pMutexName)
00109 {
00110 #ifdef WIN32
00111 return new CWin32Mutex(pMutexName);
00112 #else
00113 return NULL;
00114 #endif
00115 }
00116
00117 CGenericReadWriteLock* COSManager::CreateReadWriteLock(int iMaximumReaders)
00118 {
00119 #ifdef WIN32
00120 return new CWin32ReadWriteLock(iMaximumReaders);
00121 #else
00122 return NULL;
00123 #endif
00124 }
00125
00126 KOMODIA_NAMESPACE_END