CWin32Semaphore Class Reference#include <Win32Semaphore.h>
Inheritance diagram for CWin32Semaphore:
![]()
Collaboration diagram for CWin32Semaphore:
![]()
Detailed DescriptionDefinition at line 47 of file Win32Semaphore.h. Constructor & Destructor Documentation
Definition at line 47 of file Win32Semaphore.cpp. 00047 : CGenericSemaphore(lInitialCount,lMaxCount,pSemaphoreName), 00048 m_hSemaphore(0), 00049 m_bDontDelete(FALSE) 00050 { 00051 //Create the semaphore 00052 m_hSemaphore=CreateSemaphore(NULL, 00053 lInitialCount, 00054 lMaxCount, 00055 pSemaphoreName); 00056 00057 //Check if we are the owners 00058 if (pSemaphoreName && 00059 GetLastError()!=ERROR_ALREADY_EXISTS) 00060 SetFirst(); 00061 }
Definition at line 63 of file Win32Semaphore.cpp. 00064 { 00065 if (m_hSemaphore) 00066 //Close the semaphore 00067 CloseHandle(m_hSemaphore); 00068 }
Member Function Documentation
Implements CGenericSemaphore. Definition at line 70 of file Win32Semaphore.cpp. 00071 { 00072 DWORD dwWaitResult; 00073 00074 //Wait for the semaphore 00075 dwWaitResult=WaitForSingleObject(m_hSemaphore,ulMSTimeout); 00076 00077 //Check why did we quit 00078 return dwWaitResult==WAIT_TIMEOUT; 00079 }
Implements CGenericSemaphore. Definition at line 81 of file Win32Semaphore.cpp. 00082 { 00083 long lOld; 00084 BOOL bResult; 00085 00086 //Release it 00087 bResult=ReleaseSemaphore(m_hSemaphore,lAmount,&lOld); 00088 00089 //Check if it's an error 00090 if (bResult) 00091 return lOld; 00092 else 00093 return -1; 00094 }
Implements CWaitableObject. Definition at line 101 of file Win32Semaphore.cpp. 00102 { 00103 Release(); 00104 }
The documentation for this class was generated from the following files: |