#include "stdafx.h"

#include "WaitCursor.hpp"

volatile LONG CWaitCursor::nested_ = 0;

CWaitCursor::CWaitCursor()
{
	::SetCursor(::LoadCursor(NULL, IDC_WAIT));
	::InterlockedIncrement(&nested_);
}

CWaitCursor::~CWaitCursor()
{
	if (::InterlockedDecrement(&nested_) == 0) {
		::SetCursor(::LoadCursor(NULL, IDC_ARROW));
	}
}
