myEvent copy 2 - p // called by the OS when the thread is...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#if !defined(myEvent_H) #define myEvent_H # #define _WIN32_WINNT 0x0400 #include <windows.h> #include <string> using namespace std; u const int TIME_FOR_SCHEDULE_CALLBACK = 1000; c class myEvent { public: p myEvent(string eventName="",PAPCFUNC _pfnAPC=NULL,BOOL queueUserAPC=FALSE); virtual ~myEvent(); // return the event handle HANDLE getEventHandle() { return event; } // return the thread handle HANDLE getThread() { return thread; } H // return the address of the callback function PAPCFUNC getAPCFunc() { return pfnAPC; } // return whether the user wants to queue the callback // when event happens BOOL getQueueUserAPC() { return queueUserAPC; } B void setEvent(); // wrapper to SetEvent() void pulseEvent(); // wrapper to PulseEvent() void resetEvent(); // wrapper to ResetEvent() v // wait for the event BOOL waitForEvent(DWORD waitTime=INFINITE); private:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: p // called by the OS when the thread is instantiated, this // must have the WINAPI function declaration static DWORD WINAPI ThreadProc(LPVOID lpData); private: p HANDLE event; // event handle PAPCFUNC pfnAPC; // address of user-provided callback LPSECURITY_ATTRIBUTES sa; // SECURITY_ATTRBUTES structure DWORD threadID; // thread id HANDLE thread; // handle to thread // if the following is set to be TRUE, when the events occurs, // will call QueueUserAPC() to queue the user-provided callback // as a user defined API. if the following is set to be FALSE; // then no user-provided callback will be queued. // if pfnAPC is NULL (no user-provided callback is defined), // then the following is ignored BOOL queueUserAPC; B private: p static void getErrorDetail(int&,string&); s }; } #endif...
View Full Document

This note was uploaded on 03/27/2011 for the course COMPUTER 101 taught by Professor Bobthebuilder during the Spring '11 term at Columbia College.

Page1 / 2

myEvent copy 2 - p // called by the OS when the thread is...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online