Skip to content

QueryPerformanceFrequency failure mode not handled #2675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
graydon opened this issue Jun 21, 2012 · 6 comments
Closed

QueryPerformanceFrequency failure mode not handled #2675

graydon opened this issue Jun 21, 2012 · 6 comments
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows Operating system: Windows

Comments

@graydon
Copy link
Contributor

graydon commented Jun 21, 2012

In the runtime, in timer.cpp, timer::timer, failure of QueryPerformanceFrequency is not handled. Find out if it's possible for it to fail and, if so, get a workaround in place. Or failure. One or the other.

@lifthrasiir
Copy link
Contributor

Quick research reveals the following:

  • QueryPerformanceFrequency is supported since Windows 2000, so if we are ignoring Windows 9x we don't need a conditional compilation.
  • QueryPerformanceFrequency always defaults to GetTickCount. So it wouldn't fail even in the absence of high resolution timer.
  • QueryPerformanceFrequency rarely fails. The alternative implementation of Wine does not fail at all. The actual Windows API seems to fail with an misaligned pointer, but that can be made impossible by ensuring proper alignment (which Rust should do anyways).

@metajack
Copy link
Contributor

Is this really a production readiness thing? Seems internal. Nominating for discussion.

@msullivan
Copy link
Contributor

If we think that this can't actually fail, then we should add an assert.

@graydon
Copy link
Contributor Author

graydon commented Jul 18, 2013

just a bug, removing milestone/nomination.

@pnkfelix
Copy link
Member

pnkfelix commented Oct 9, 2013

Visiting for triage, email from 2013 sep 30

@msullivan you mean to assert that the input address we feed to QueryPerformanceFrequency is quad-word aligned? Or do you mean we should assert that the value stored in ticks_per_s after it returns is non-zero? (Or both?)

@brson
Copy link
Contributor

brson commented Nov 1, 2013

Same for QueryPerformanceCounter. Let's just assert that the functions succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows Operating system: Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants