473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SleepEx problem

SleepEx suspends the current thread until the specified condition is
met. I expected the execution to resume when occurs the timeout happens
in my following example.

At the expiry of the timer it is calling "lpFnToCompletionRoutine" as
expected, but it is not printing Count in the while loop. Can anyone
explain why?


static void APIENTRY lpFnToCompletionRoutine (LPVOID lpCount,
DWORD dwTimerLowValue,
DWORD dwTimerHighValue)
{
*(LPWORD) lpCount = *(LPWORD) lpCount + 1;

}

void OmciAdapter::adapterMain()
{

/* STEPS to DO: */

//1. set the timer for every 100 milli secs to check for any OMCI
timeouts

HANDLE hTimer;
LARGE_INTEGER DueTime;
DWORD Count = 0;
const int unitsPerSecond=10*1000*1000; // 100 nano seconds
DueTime.QuadPart = -(10000 * 10000);
hTimer = CreateWaitableTimer(NULL, FALSE, "WaitableTimer");

if (NULL == hTimer)
{
printf("CreateWaitableTimer failed (%d)\n", GetLastError());
return;
}

printf("Waiting for 10 seconds...\n");

// Set a timer to wait for 10 seconds.
if (!SetWaitableTimer(hTimer, &DueTime, 10000,
lpFnToCompletionRoutine, &Count, FALSE))
{
printf("SetWaitableTimer failed (%d)\n", GetLastError());
return;
}

while (1)
{
printf ("Count = %d \n", Count);
SleepEx(INFINITE, TRUE);
}

.................

.................

.................

.................
}

Sep 6 '06 #1
1 5580
NewToCPP wrote:
SleepEx suspends the current thread until the specified condition is
met. I expected the execution to resume when occurs the timeout
happens in my following example.

At the expiry of the timer it is calling "lpFnToCompletionRoutine" as
expected, but it is not printing Count in the while loop. Can anyone
explain why?
[...]
Somebody in the newsgroup that deals with those functions and their
semantics should be able to. I can only speculate that your timers
are not running in a separate thread, and as such are probably just
as well suspended by your SleepEx. But your question is OS-specific
and as such is off-topic here. The list of suggested newsgroups is
in the FAQ.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.