|
첫번째 질문 : CRITICAL_SECTION으로 선언했을 경우
if(TryEnterCriticalSection(&Cs))
{
LeaveCriticalSection(&Cs);
}
else SwitchToThread();
식으로 사용해야하는 걸로 아는데요..
TCriticalSection의 경우에는
if(Cs->TryEnter())
{
Cs->Leave();
}
라고만 하면 끌인가요?
두번째 질문 : Acquire(), Release()와 Enter(), Leave()의 차이가 뭔지요?
세번째 질문 : 아래처럼 TryEnter()를 쓰면 그에 대응하는 지점에도 Acquire()가 아닌 Enter()를 써야만 하나요?
if(Cs->TryEnter())
{
a = c;
Cs->Leave();
}
Cs->Enter(); // 굳이 Enter()로 써야만 하는지요?
a = b;
Cs->Leave();
|