[ofw] patch: [complib] Allow the timer to work with windows 2003

Tzachi Dar tzachid at mellanox.co.il
Mon Sep 20 03:52:24 PDT 2010


So we are talking about something like:

#if WINVER >= 0x600
#define CL_MAX_TIME INFINITE
#else
#define CL_MAX_TIME 0xFFFFFFFE
#endif

By the way, there is nothing in the ChangeTimerQueueTimer docs that says that it can really wait for infinite time.

Thanks
Tzachi

From: Fab Tillier [mailto:ftillier at microsoft.com]
Sent: Sunday, September 19, 2010 8:24 PM
To: Tzachi Dar; ofw at lists.openfabrics.org; Sean Hefty
Subject: RE: patch: [complib] Allow the timer to work with windows 2003

Can we make the FFFFFFFE define only happen on Windows Server 2003, and use the INFINITE value for the newer operating systems?

From: ofw-bounces at lists.openfabrics.org [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Tzachi Dar
Sent: Sunday, September 19, 2010 5:20 AM
To: Tzachi Dar; ofw at lists.openfabrics.org; Sean Hefty
Subject: Re: [ofw] patch: [complib] Allow the timer to work with windows 2003

Applied on 2934.

Thanks
Tzachi

From: Tzachi Dar
Sent: Saturday, September 11, 2010 10:31 PM
To: Tzachi Dar; ofw at lists.openfabrics.org; Sean Hefty
Cc: Uri Habusha
Subject: RE: patch: [complib] Allow the timer to work with windows 2003



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/20100920/a4580c3a/attachment.html>


More information about the ofw mailing list