You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.0 KiB
C++

#pragma once
#include <stdexcept>
#include "DllDefines.h"
class UTILITYDLL CMyWaitTimeoutException : public std::exception
{
public:
CMyWaitTimeoutException();
virtual ~CMyWaitTimeoutException();
};
class UTILITYDLL CMyWaitInterruptedException : public std::exception
{
public:
CMyWaitInterruptedException();
virtual ~CMyWaitInterruptedException();
};
class UTILITYDLL CMyWait
{
public:
CMyWait();
virtual ~CMyWait();
// ************************************
// Method: Wait
// FullName: CMyWait::Wait
// Access: public
// Returns: DWORD
// Qualifier:
// Parameter: HANDLE handle
// Parameter: DWORD dwTimeout
// ************************************
///////////////////////////////////////////////////////////////////////////////
// return : 0 -> timeout or error
// 1 -> first event signal
static DWORD Wait(HANDLE handle, DWORD dwTimeout);
///////////////////////////////////////////////////////////////////////////////
// return : 1 -> first event signal
// throw exception on timeout or error
static DWORD WaitEx(HANDLE handle, DWORD dwTimeout);
///////////////////////////////////////////////////////////////////////////////
// return : 0 -> timeout or error
// 1 -> first event signal
// n -> n th event signal
static DWORD Wait(LPHANDLE handle, BOOL bWaitForAll, DWORD dwTimeout, int nNoOfHandle);
///////////////////////////////////////////////////////////////////////////////
// return : 1 -> first event signal
// n -> n th event signal
// throw exception on timeout or error
static DWORD WaitEx(LPHANDLE handle, BOOL bWaitForAll, DWORD dwTimeout, int nNoOfHandle);
static void Interrupt(DWORD threadId);
// This sleep function will return after the delay in millis and
// continue to process messages send to the Main UI message pump
static void Sleep(DWORD millis);
};