Esempio n. 1
0
	Void Event::Reset()
	{
		if (!m_handle.IsValid())
		{
			THROW_INVALID_HANDLE_EXCEPTION();
		}

		BOOL success = ::ResetEvent(m_handle);
		if (!success)
		{
			THROW_LAST_ERROR_EXCEPTION();
		}
	}
Esempio n. 2
0
	Void Event::Wait(UInt32 milliseconds) const
	{
		if (!m_handle.IsValid())
		{
			THROW_INVALID_HANDLE_EXCEPTION();
		}

		DWORD result = ::WaitForSingleObject(m_handle, milliseconds);
		if (WAIT_FAILED == result)
		{
			THROW_LAST_ERROR_EXCEPTION();
		}
	}
	Void Process::Wait(UInt32 milliseconds) const
	{
		Handle handle(m_handle);
		if (!handle.IsValid())
		{
			handle = ::OpenProcess(SYNCHRONIZE, False, m_id);
			if (!handle.IsValid())
				THROW_INVALID_HANDLE_EXCEPTION();
		}

		DWORD result = ::WaitForSingleObject(handle, milliseconds);
		if (WAIT_FAILED == result)
		{
			THROW_LAST_ERROR_EXCEPTION();
		}
	}