Update of /cvsroot/com0com/hub4com
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26801
Modified Files:
hub4com.cpp precomp.h
Log Message:
Itilized TimerAPCProc()
Index: precomp.h
===================================================================
RCS file: /cvsroot/com0com/hub4com/precomp.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** precomp.h 16 Apr 2008 14:09:41 -0000 1.4
--- precomp.h 25 Aug 2008 08:15:02 -0000 1.5
***************
*** 20,23 ****
--- 20,26 ----
*
* $Log$
+ * Revision 1.5 2008/08/25 08:15:02 vfrolov
+ * Itilized TimerAPCProc()
+ *
* Revision 1.4 2008/04/16 14:09:41 vfrolov
* Included <set>
***************
*** 37,40 ****
--- 40,45 ----
#define _PRECOMP_H_
+ #define _WIN32_WINNT 0x0500
+
#include <windows.h>
#include <crtdbg.h>
Index: hub4com.cpp
===================================================================
RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** hub4com.cpp 16 Apr 2008 14:13:59 -0000 1.11
--- hub4com.cpp 25 Aug 2008 08:15:02 -0000 1.12
***************
*** 20,23 ****
--- 20,26 ----
*
* $Log$
+ * Revision 1.12 2008/08/25 08:15:02 vfrolov
+ * Itilized TimerAPCProc()
+ *
* Revision 1.11 2008/04/16 14:13:59 vfrolov
* Added ability to specify source posts for OUT method
***************
*** 539,542 ****
--- 542,553 ----
}
///////////////////////////////////////////////////////////////
+ static VOID CALLBACK TimerAPCProc(
+ LPVOID pArg,
+ DWORD /*dwTimerLowValue*/,
+ DWORD /*dwTimerHighValue*/)
+ {
+ ((ComHub *)pArg)->LostReport();
+ }
+ ///////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
***************
*** 546,561 ****
if (hub.StartAll()) {
! DWORD nextReportTime = 0;
! for (;;) {
! SleepEx(5000, TRUE);
! DWORD time = GetTickCount();
! if ((nextReportTime - time - 1) > 10000) {
! hub.LostReport();
! nextReportTime = time + 5000;
}
}
}
--- 557,582 ----
if (hub.StartAll()) {
! HANDLE hTimer = ::CreateWaitableTimer(NULL, FALSE, NULL);
! if (hTimer) {
! LARGE_INTEGER firstReportTime;
! firstReportTime.QuadPart = -100000000;
! if (!::SetWaitableTimer(hTimer, &firstReportTime, 10000, TimerAPCProc, &hub, FALSE)) {
! DWORD err = GetLastError();
!
! cerr << "WARNING: SetWaitableTimer() - error=" << err << endl;
!
! ::CloseHandle(hTimer);
}
+ } else {
+ DWORD err = GetLastError();
+
+ cerr << "WARNING: CreateWaitableTimer() - error=" << err << endl;
}
+
+ for (;;)
+ ::SleepEx(INFINITE, TRUE);
}
|