qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [CFT PATCH 04/12] change qemu_thread_equal API to always compare with current thread
Date: Tue, 08 Feb 2011 21:25:19 +0100	[thread overview]
Message-ID: <4D51A6AF.8000309@web.de> (raw)
In-Reply-To: <1297185509-20996-5-git-send-email-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2209 bytes --]

On 2011-02-08 18:18, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  cpus.c        |   10 ++--------
>  qemu-thread.c |    4 ++--
>  qemu-thread.h |    2 +-
>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/cpus.c b/cpus.c
> index 474be16..c1d0ceb 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -857,11 +857,8 @@ void qemu_cpu_kick_self(void)
>  int qemu_cpu_self(void *_env)
>  {
>      CPUState *env = _env;
> -    QemuThread this;
>  
> -    qemu_thread_self(&this);
> -
> -    return qemu_thread_equal(&this, env->thread);
> +    return qemu_thread_equal(env->thread);
>  }
>  
>  void qemu_mutex_lock_iothread(void)
> @@ -990,10 +987,7 @@ void cpu_stop_current(void)
>  
>  void vm_stop(int reason)
>  {
> -    QemuThread me;
> -    qemu_thread_self(&me);
> -
> -    if (!qemu_thread_equal(&me, &io_thread)) {
> +    if (!qemu_thread_equal(&io_thread)) {
>          qemu_system_vmstop_request(reason);
>          /*
>           * FIXME: should not return to device code in case
> diff --git a/qemu-thread.c b/qemu-thread.c
> index fbc78fe..7f5c0b6 100644
> --- a/qemu-thread.c
> +++ b/qemu-thread.c
> @@ -181,9 +181,9 @@ void qemu_thread_self(QemuThread *thread)
>      thread->thread = pthread_self();
>  }
>  
> -int qemu_thread_equal(QemuThread *thread1, QemuThread *thread2)
> +int qemu_thread_equal(QemuThread *thread)
>  {
> -   return pthread_equal(thread1->thread, thread2->thread);
> +   return pthread_equal(pthread_self(), thread->thread);
>  }
>  
>  void qemu_thread_exit(void *retval)
> diff --git a/qemu-thread.h b/qemu-thread.h
> index 19bb30c..fa4bfb9 100644
> --- a/qemu-thread.h
> +++ b/qemu-thread.h
> @@ -38,7 +38,7 @@ void qemu_thread_create(QemuThread *thread,
>                         void *arg);
>  void qemu_thread_signal(QemuThread *thread, int sig);
>  void qemu_thread_self(QemuThread *thread);
> -int qemu_thread_equal(QemuThread *thread1, QemuThread *thread2);
> +int qemu_thread_equal(QemuThread *thread);
>  void qemu_thread_exit(void *retval);
>  
>  #endif

I would call this "qemu_thread_is_current" or so to clarify what is
tested here.

JAn


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2011-02-08 20:25 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 17:18 [Qemu-devel] [CFT PATCH 00/12] Tricky parts of my iothread-for-win32 stuff Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 01/12] io-thread: make sure to initialize qemu_work_cond and qemu_cpu_cond Paolo Bonzini
2011-02-14 19:21   ` Anthony Liguori
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 02/12] cris, microblaze: use cpu_has_work Paolo Bonzini
2011-02-08 19:42   ` Edgar E. Iglesias
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 03/12] inline cpu_halted into sole caller Paolo Bonzini
2011-02-08 20:24   ` [Qemu-devel] " Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 04/12] change qemu_thread_equal API to always compare with current thread Paolo Bonzini
2011-02-08 20:25   ` Jan Kiszka [this message]
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 05/12] always qemu_cpu_kick after unhalting a cpu Paolo Bonzini
2011-02-08 20:25   ` [Qemu-devel] " Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 06/12] exit round-robin vcpu loop if cpu->stopped is true Paolo Bonzini
2011-02-08 20:24   ` [Qemu-devel] " Jan Kiszka
2011-02-09  7:24     ` Paolo Bonzini
2011-02-09  7:24     ` Paolo Bonzini
2011-02-09  8:40       ` Jan Kiszka
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 07/12] always signal pause_cond after stopping a VCPU Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 08/12] do not use timedwait on qemu_halt_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 09/12] do not use timedwait on qemu_system_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 10/12] do not use timedwait on qemu_pause_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 11/12] do not use timedwait on qemu_cpu_cond Paolo Bonzini
2011-02-08 17:18 ` [Qemu-devel] [CFT PATCH 12/12] iothread stops the vcpu thread via IPI Paolo Bonzini
2011-02-08 19:31 ` [Qemu-devel] [CFT PATCH 00/12] Tricky parts of my iothread-for-win32 stuff Aurelien Jarno
2011-02-08 20:38 ` [Qemu-devel] " Jan Kiszka

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=4D51A6AF.8000309@web.de \
    --to=jan.kiszka@web.de \
    --cc=pbonzini@redhat.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).