From: Tzachi Dar [mailto:[email protected]] Sent: Wednesday, September 08, 2010 10:17 AM To: [email protected]; Sean Hefty Cc: Uri Habusha Subject: RE: patch: [complib] Allow the timer to work with windows 2003
Resending since ofw was down. From: Tzachi Dar [mailto:[email protected]] Sent: Tuesday, September 07, 2010 7:02 PM To: [email protected]; Sean Hefty Cc: Uri Habusha Subject: patch: [complib] Allow the timer to work with windows 2003 It seems that windows 2003 timer does not work with a period of 0xffffffff. The workaround is to use the constant 0xfffffffe instead. Index: B:/users/tzachid/MLNX_WinOF-2_1_2/core/complib/user/cl_timer.c =================================================================== --- B:/users/tzachid/MLNX_WinOF-2_1_2/core/complib/user/cl_timer.c (revision 6479) +++ B:/users/tzachid/MLNX_WinOF-2_1_2/core/complib/user/cl_timer.c (revision 6480) @@ -34,7 +34,8 @@ #include "complib/cl_timer.h" -#define CL_MAX_TIME 0xFFFFFFFF +// Using FFFFFFFF will not work on windows 2003 +#define CL_MAX_TIME 0xFFFFFFFE /* In order to verify us, you can try running the following program on 2003 and on 2008. Thanks Tzachi and xalex #include <windows.h> #include <stdio.h> HANDLE hTimer = NULL; HANDLE hTimerQueue = NULL; int arg = 123; #define CL_MAX_TIME 0xFFFFFFFE VOID CALLBACK TimerRoutine(PVOID lpParam, BOOLEAN TimerOrWaitFired) { printf("Rescheduling it again\n"); if (!ChangeTimerQueueTimer( hTimerQueue , hTimer, 500, CL_MAX_TIME)) { printf("ChangeTimerQueueTimer failed (%d)\n", GetLastError()); return; } printf("Exiting callback\n"); } int main() { // Create the timer queue. hTimerQueue = CreateTimerQueue(); if (NULL == hTimerQueue) { printf("CreateTimerQueue failed (%d)\n", GetLastError()); return 2; } if (!CreateTimerQueueTimer( &hTimer, hTimerQueue , (WAITORTIMERCALLBACK)TimerRoutine, &arg , CL_MAX_TIME, CL_MAX_TIME , WT_EXECUTEINTIMERTHREAD)) { printf("CreateTimerQueueTimer failed (%d)\n", GetLastError()); return ;//3; } if (!ChangeTimerQueueTimer( hTimerQueue , hTimer, 500, CL_MAX_TIME)) { printf("ChangeTimerQueueTimer failed (%d)\n", GetLastError()); return; } SleepEx (100000,TRUE); printf("After sleep\n"); return 0; }
_______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
