delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/27/16:51:32

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 27 Mar 2012 22:50:50 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: clock_getres(CLOCK_REALTIME, .) may return an outdated and too high resolution
Message-ID: <20120327205050.GB25716@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4F6A5D42 DOT 3030108 AT t-online DOT de> <20120322093340 DOT GW18032 AT calimero DOT vinschen DOT de> <4F6B65A7 DOT 9080605 AT t-online DOT de> <20120326085159 DOT GJ2425 AT calimero DOT vinschen DOT de> <4F70A0C9 DOT 5060208 AT t-online DOT de> <20120327091051 DOT GB30721 AT calimero DOT vinschen DOT de> <4F72007D DOT 6080503 AT t-online DOT de> <20120327182823 DOT GV30721 AT calimero DOT vinschen DOT de> <4F720E19 DOT 5000809 AT t-online DOT de>
MIME-Version: 1.0
In-Reply-To: <4F720E19.5000809@t-online.de>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar 27 20:59, Christian Franke wrote:
> 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.

Hmpf, ok.  Boy is that ugly.  Is there a chance that actual is bigger
than period?  In that case we should perhaps set minperiod like this:

  minperiod = MAX (actual, period);


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019