From: "Sebastian Herbszt" <herbszt@gmx.de>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: "Anthony Liguori" <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, "Teemu Nätkinniemi" <stinkf42@yahoo.com>
Subject: [Qemu-devel] Re: Threads and win32
Date: Mon, 20 Jul 2009 21:09:47 +0200 [thread overview]
Message-ID: <EBABC6CD41314FCC9BEBE4B6B272CB7F@FSCPC> (raw)
In-Reply-To: <20090720160729.GA9738@amt.cnet>
Marcelo Tosatti wrote:
> On Sun, Jul 19, 2009 at 02:11:09PM +0200, Sebastian Herbszt wrote:
>> Marcelo, can gettimeofday be used instead of clock_gettime?
>>
> Sure, gettimeofday instead of clock_gettime is fine.
If clock_gettime() is replaced by gettimeofday() qemu-thread.c does compile on MinGW if
also the pthread_equal patch [1] is applied. Unfortunatelly there is a ton of compile errors
in vl.c due to incomplete signal support (?).
[1] http://lists.gnu.org/archive/html/qemu-devel/2009-07/msg01514.html
- Sebastian
[PATCH] qemu-thread: replace clock_gettime() by gettimeofday()
Replace clock_gettime() which is not available on MinGW by gettimeofday().
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
--- qemu-c62bb/qemu-thread.c.orig Mon Jul 20 18:38:24 2009
+++ qemu-c62bb/qemu-thread.c Mon Jul 20 18:53:53 2009
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <errno.h>
#include <time.h>
+#include <sys/time.h>
#include <signal.h>
#include <stdint.h>
#include <string.h>
@@ -62,8 +63,11 @@ int qemu_mutex_timedlock(QemuMutex *mute
{
int err;
struct timespec ts;
+ struct timeval now;
- clock_gettime(CLOCK_REALTIME, &ts);
+ gettimeofday(&now, NULL);
+ ts.tv_sec = now.tv_sec;
+ ts.tv_nsec = now.tv_usec * 1000;
timespec_add_ms(&ts, msecs);
err = pthread_mutex_timedlock(&mutex->lock, &ts);
@@ -120,9 +124,12 @@ void qemu_cond_wait(QemuCond *cond, Qemu
int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs)
{
struct timespec ts;
+ struct timeval now;
int err;
- clock_gettime(CLOCK_REALTIME, &ts);
+ gettimeofday(&now, NULL);
+ ts.tv_sec = now.tv_sec;
+ ts.tv_nsec = now.tv_usec * 1000;
timespec_add_ms(&ts, msecs);
err = pthread_cond_timedwait(&cond->cond, &mutex->lock, &ts);
next prev parent reply other threads:[~2009-07-20 19:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-18 19:27 [Qemu-devel] Threads and win32 Teemu Nätkinniemi
2009-07-19 12:11 ` [Qemu-devel] " Sebastian Herbszt
2009-07-20 16:07 ` Marcelo Tosatti
2009-07-20 19:09 ` Sebastian Herbszt [this message]
2009-07-20 23:52 ` Marcelo Tosatti
2009-07-21 12:11 ` Sebastian Herbszt
2009-07-21 12:58 ` Jamie Lokier
2009-07-21 13:22 ` Teemu Nätkinniemi
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=EBABC6CD41314FCC9BEBE4B6B272CB7F@FSCPC \
--to=herbszt@gmx.de \
--cc=aliguori@us.ibm.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stinkf42@yahoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.