[ofw] patch: [complib] Allow the timer to work with windows 2003
Tzachi Dar
tzachid at mellanox.co.il
Sat Sep 11 12:29:25 PDT 2010
From: Tzachi Dar [mailto:tzachid at mellanox.co.il]
Sent: Wednesday, September 08, 2010 10:17 AM
To: ofw at lists.openfabrics.org; 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:tzachid at mellanox.co.il]
Sent: Tuesday, September 07, 2010 7:02 PM
To: ofw at lists.openfabrics.org; 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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100911/a1bb2b82/attachment.html>
More information about the ofw
mailing list