class ITimerObserver
{
public:
virtual void IntervalCallback(void) = 0;
virtual void TerminatedCallback(void) = 0;
};
struct TimerThreadParam
{
unsigned int interval;
ITimerObserver* observerRef;
volatile bool* isPause;
volatile bool* isStop;
};
class CPreciseTimer
{
public:
CPreciseTimer(unsigned int, ITimerObserver*);
void Start();
void Pause();
void Terminate();
~CPreciseTimer(void);
private:
TimerThreadParam m_param;
CWinThread *m_pThread;
bool m_isPause;
bool m_isStop;
};
#include "PreciseTimer.h"
#include <math.h>
UINT AFX_CDECL internalTimerThread(LPVOID lpParam)
{
TimerThreadParam *param = (TimerThreadParam *)lpParam;
unsigned int interval = param->interval;
ITimerObserver* observer = param->observerRef;
volatile bool *isPause = param->isPause;
volatile bool *isStop = param->isStop;
LARGE_