public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: cygwin@cygwin.com
Subject: Re: clock_getres(CLOCK_REALTIME, .) may return an outdated and too high resolution
Date: Tue, 27 Mar 2012 19:00:00 -0000	[thread overview]
Message-ID: <4F720E19.5000809@t-online.de> (raw)
In-Reply-To: <20120327182823.GV30721@calimero.vinschen.de>

Corinna Vinschen wrote:
> On Mar 27 20:01, Christian Franke wrote:
>> Corinna Vinschen wrote:
>>> On Mar 26 19:00, Christian Franke wrote:
>>>> Corinna Vinschen wrote:
>>>>> I see your point, but what bugs me a bit is the fact that
>>>>> clock_getres(CLOCK_REALTIME) and clock_setres(CLOCK_REALTIME) will
>>>>> always return the same value coarsest, regardless what value has been set.
>>>> If clock_setres was called and succeeded, then clock_getres(.)
>>>> should return the value set before.
>>>>
>>>> If clock_setres was not called, the coarsest value is IMO the only
>>>> value that can be guaranteed.
>>>>
>>>> The actual value returned by NtQueryTimerResolution is simply
>>>> useless in this context: It is the minimum of all resolutions
>>>> currently set by all running processes. It may change at any time.
>>>> There is apparently no way the query the current setting of the
>>>> current process.
>>> Uh, right, I misunderstood.  I reverted the change to clock_setres.
>> Sorry, I probably forgot to mention that NtSetTimerResolution
>> returns the same useless actual value than NtQueryTimerResolution.
>>
>> I would suggest:
>>
>>      status = NtSetTimerResolution (period, TRUE,&actual);
>>      if (!NT_SUCCESS (status))
>>        { ... return -1; }
>>   -  minperiod = actual;
>>   +  minperiod = period;
> But that's not right.  The "actual" value is not useless, but the value
> the resolution has actually been set to.

No, again this is the minimum of all resolutions currently set by all 
processes.


>    The OS just doesn't support
> arbitrary values for the period.
>

Yes - but in 'actual' a smaller value than the value set for the current 
process may be returned.

Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2012-03-27 19:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 23:00 Christian Franke
2012-03-22  9:34 ` Corinna Vinschen
2012-03-22  9:39   ` Peter Rosin
2012-03-22  9:50     ` Corinna Vinschen
2012-03-22 17:47   ` Christian Franke
2012-03-26  8:52     ` Corinna Vinschen
2012-03-26 17:01       ` Christian Franke
2012-03-27  9:11         ` Corinna Vinschen
2012-03-27 18:02           ` Christian Franke
2012-03-27 18:29             ` Corinna Vinschen
2012-03-27 19:00               ` Christian Franke [this message]
2012-03-27 20:51                 ` Corinna Vinschen
2012-03-27 21:29                   ` Christian Franke
2012-03-28  7:40                     ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F720E19.5000809@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).