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

Reply via email to