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

Tzachi Dar tzachid at mellanox.co.il
Sun Sep 19 16:18:29 PDT 2010


Yes we can.

What is the value of INFINITE? 0xffffffff?

Thasks
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/091ba7d2/attachment.html>


More information about the ofw mailing list