From: Paolo Bonzini <pbonzini@redhat.com>
To: Tristan Gingold <gingold@adacore.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] Autodetect clock_gettime
Date: Tue, 15 Mar 2011 14:58:55 +0100 [thread overview]
Message-ID: <4D7F709F.8080204@redhat.com> (raw)
In-Reply-To: <1DE9D55B-9D5D-4A58-8BA5-0D32DF4A9E05@adacore.com>
On 03/15/2011 02:47 PM, Tristan Gingold wrote:
>
> On Mar 15, 2011, at 2:34 PM, Paolo Bonzini wrote:
>
>> On 03/15/2011 02:16 PM, Tristan Gingold wrote:
>>> Some POSIX OSes (such as Darwin) doesn't have clock_gettime. This patch
>>> falls back on gettimeofday if clock_gettime is not available.
>>
>> This may be okay as a stopgap measure, but any sane porting target for QEMU should have a monotonic clock. In fact, Darwin has it.
>
> Yes mach primitives could be used. But why isn't a monotonic clock used on Linux ? According to man, CLOCK_MONOTONIC is monotonic
> while CLOCK_REALTIME isn't.
/me rereads the patch
Unfortunately, pthread timed wait/lock functions are documented to use
the realtime clock by default. Using pthread_condattr_setclock is
probably not portable enough, and anyway there is no such function for
mutexes so we're stuck with CLOCK_REALTIME. What you're patching is
fine, but those functions might actually go away soon as they're not
supported on Win32.
So, in addition to what you've done, you should probably use those Mach
primitives in qemu-timer.h.
Paolo
next prev parent reply other threads:[~2011-03-15 13:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-15 13:16 [Qemu-devel] [PATCH] Autodetect clock_gettime Tristan Gingold
2011-03-15 13:34 ` [Qemu-devel] " Paolo Bonzini
2011-03-15 13:47 ` Tristan Gingold
2011-03-15 13:58 ` Paolo Bonzini [this message]
2011-03-15 14:17 ` Tristan Gingold
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=4D7F709F.8080204@redhat.com \
--to=pbonzini@redhat.com \
--cc=gingold@adacore.com \
--cc=qemu-devel@nongnu.org \
/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 NNTP newsgroup(s).