473,406 Members | 2,843 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,406 software developers and data experts.

High Resolution version of Sleep() in Windows


Has anyone come across a way to sleep (suspend execution of current
process while releasing CPU resources in the meantime) for less than a
millisecond in Windows? I know it has been done by third parties such
as with the XBO LLADRV project, but I cannot get even enough support
from them to enable their software in my project. Ideally, I need
something like the unix usleep() function which will do a
processor-friendly sleep for some number of microseconds or
nanoseconds. The LLADRV project supposedly does this for Windows
through low-level access to the OS using their LladrvWaitPreciseTime()
function.

I am using MSVC++ .Net 2003. Thanks for any leads.

--
Michael Evans
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #1
3 6212
"Michael Evans" <Mi******************@mail.codecomments.com> wrote in
message news:Mi******************@mail.codecomments.com...
Has anyone come across a way to sleep (suspend execution of current
process while releasing CPU resources in the meantime) for less than a
millisecond in Windows?


Nope.

The best you can do in an application and without specialized hardware is to
use QueryPerformanceCounter() and QueryPerformanceFrequency() to poll the
counter while spinning a busy loop. But that would not "release CPU
resources in the meantime" as you put it.

Regards,
Will

Nov 17 '05 #2
Use SetTimer(...)/OnTimer(...)

"Michael Evans" wrote:

Has anyone come across a way to sleep (suspend execution of current
process while releasing CPU resources in the meantime) for less than a
millisecond in Windows? I know it has been done by third parties such
as with the XBO LLADRV project, but I cannot get even enough support
from them to enable their software in my project. Ideally, I need
something like the unix usleep() function which will do a
processor-friendly sleep for some number of microseconds or
nanoseconds. The LLADRV project supposedly does this for Windows
through low-level access to the OS using their LladrvWaitPreciseTime()
function.

I am using MSVC++ .Net 2003. Thanks for any leads.

--
Michael Evans
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #3
"in**@u-s-tech.com" <in***********@discussions.microsoft.com> wrote in
message news:42**********************************@microsof t.com...
Use SetTimer(...)/OnTimer(...)


The OP's requirement was a preiod "less than a millisecond". And further, as
a concession to the prehistoric versions of Windows, the dispatching of
WM_TIMER messages that are synthesized in response to SetTimer() is deferred
until there is almost nothing else in the queue.

In short, SetTimer() is almost never the right choice.

Regards,
Will
Nov 17 '05 #4

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

Similar topics

1
by: Do Park via SQLMonster.com | last post by:
Hello all, 1. Is there a DOS command to check version of Windows server 2003 ( or 2000)? and Is there a DOS command to check version of SP in Windows Server? Thanks in advance, Do. --
2
by: Ben Amada | last post by:
Hi group. I'm going to display a low resolution image in an HTML page. On the web server, I have a high resolution version of that image. If I display the high resolution image in the browser...
2
by: Michael Evans | last post by:
First, we rely on a stable update rate so that our physics and dynamics calculations and integrations are based on a known interval and therefore are true-to-life. Second, the graphics positions...
6
by: moondaddy | last post by:
I have an application where I need to print images where the size has been reduced down to a fraction of a thumbnail and the original image is several inches high and wide. We're using a special...
12
by: Xah Lee | last post by:
Python has a new logo! See http://python.org/ And it is a fantastic logo. Xah xah@xahlee.org ∑ http://xahlee.org/
3
subashini Thiyagarajan
by: subashini Thiyagarajan | last post by:
Hi all, The animated flash documents are not having good resolution.can any one suggest how can i get high resolution picture in flash with good clarity.what i need to do for that. expecting some...
19
by: John | last post by:
The table below shows the execution time for this code snippet as measured by the unix command `time': for i in range(1000): time.sleep(inter) inter execution time ideal 0 ...
3
by: Claire | last post by:
I need to read data from one of two file locations depending on whether the application is hosted on Vista or an older version of windows. On older systems its on a subdirectory of the application,...
3
by: Jim Richards | last post by:
When I print out the Help files for an error, it says: "1. Make sure that the Web server computer is running a server version of Windows 2000, Windows XP, or Windows Server 2003. At this point,...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.