分类: C/C++
2013-04-01 10:55:39
VOID InitializeCriticalSection( LPCRITICAL_SECTION // critical section );构建一个关键代码段对象
VOID EnterCriticalSection( LPCRITICAL_SECTION // critical section );获取关键代码段的权限 会blockBOOL TryEnterCriticalSection( LPCRITICAL_SECTION // critical section );VOID LeaveCriticalSection( LPCRITICAL_SECTION // critical section );使用完后要归还权限VOID DeleteCriticalSection( LPCRITICAL_SECTION // critical section ); 删除该关键代码段对象CRITICAL_SECTION 关键代码段数据结构事件对象:HANDLE CreateEvent(LPSECURITY_ATTRIBUTES , // SD BOOL , // reset type BOOL , // initial state LPCTSTR // object name );创建一个事件对象可以设置人工重置或自动重置,有信号和无信号, 返回一个事件对象句柄BOOL ResetEvent( HANDLE // handle to event);设置为无信号状态BOOL SetEvent( HANDLE // handle to event);设置为有信号状态BOOL CloseHandle( HANDLE // handle to object);互斥对象:HANDLE CreateMutex( LPSECURITY_ATTRIBUTES , // SD BOOL bInitialOwner, // initial owner LPCTSTR // object name);构建一个互斥队想的句柄DWORD WaitForSingleObject( HANDLE , // handle to object DWORD // time-out interval);获取gai互斥对象BOOL ReleaseMutex( HANDLE // handle to mutex);释放该互斥对象BOOL CloseHandle( HANDLE // handle to object);