You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Ro...@AUDI.DE on 2006/11/22 10:41:20 UTC

High resolution timers/sleeping on Win32

There is a nice (but tricky) way to implement a high resolution sleep
function on Win32. I checked the current APR code, but could not find such
an extension to the standard timing functions.

Is it planned to implement that feature? If so, I might be able to
contribute an unofficial raw version of that implementation - which in the
end is a combination of multimedia-timers and critical sections that
bypasses some of the scheduling problems.

Btw: How accurate is nanosleep on current Linux kernels? Do you get up to
1ms accurate sleeping times?

---
Roland.

PS. ...just found APR and now I'm evaluating it as a replacement for our
existing Win32/Linux API wrapper - so please be gentle upon newbie
questions.


Re: High resolution timers/sleeping on Win32

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Roland.Schabenberger@AUDI.DE wrote:
> There is a nice (but tricky) way to implement a high resolution sleep
> function on Win32. I checked the current APR code, but could not find
> such an extension to the standard timing functions.

Patches welcome; the resolution of apr_time_interval_t is microseconds,
the proposed function shouldn't attempt to be more granular than that.

> Is it planned to implement that feature? If so, I might be able to
> contribute an unofficial raw version of that implementation - which in
> the end is a combination of multimedia-timers and critical sections that
> bypasses some of the scheduling problems.

Just please watch that it's either your own code - or that it fits in the
scope of the ASF license.  BSD licensed code is no problem, GPL code would
obviously not work.

> Btw: How accurate is nanosleep on current Linux kernels? Do you get up
> to 1ms accurate sleeping times?

Dunno - hope another here does.

> PS. ...just found APR and now I'm evaluating it as a replacement for our
> existing Win32/Linux API wrapper - so please be gentle upon newbie
> questions.

No hassle - that's why the project exists :)