Platform/IPC

동기화 - Win32

jjryu 2009. 2. 14. 22:05
race condition
자원을 공유시 경쟁 상황


교착 상태
두 개 이상의 동기화 오브젝트들을 획득시 발생 // ???

회피 방법
시도하고 물러나기(try and back off)

모든 스레드들이 동일한 순서로 동기화 오브젝트들을 얻고 그 반대 순서로 해제

WaitForMultipleObjects()

다른 스레드(프로세스)의 종료를 대기
WaitForSingleObject()
WaitForMultipleObjects()
MAXIMUM_WAIT_OBJECTS
c.f. WaitForInputIdle()

파일 잠금

HeapLock()
HeadpUnlock()

InterlockedIncrement()

CRITICAL_SECTION
InitializeCriticalSection()
InitializeCriticalSectionAndSpinCount()
DeleteCriticalSection()
EnterCriticalSection()
TryCriticalSection()
SetCriticalSectionSpinCount()
LeaveCriticalSection()

뮤텍스
CreateMutex()
OpenMutex()
CloseHandle()
WaitForSingleObject()
WaitForMultipleObjects()
ReleaseMutex()

세마포어
다중 대기시 문제가 있다.

CreateSemaphore()
OpenSemaphorer()
CloseHandle()
WaitForSingleObject()
WaitForMultipleObjects()
ReleaseSemaphore()

CreateEvent()
CloseHandle()
SetEvent()

CreateWatableTimer()
CloseHandle()
SetWatableTimer()
CancelWatableTimer()

익명 파이프
지명 파이프

메일 슬롯


참조 사이트: