qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Prerna Saxena <prerna@linux.vnet.ibm.com>
Subject: [Qemu-devel] Re: [PATCH] simpletrace: Thread-safe tracing
Date: Sun, 27 Feb 2011 16:13:12 +0100	[thread overview]
Message-ID: <4D6A6A08.8000300@redhat.com> (raw)
In-Reply-To: <1298818682-5404-1-git-send-email-stefanha@linux.vnet.ibm.com>

On 02/27/2011 03:58 PM, Stefan Hajnoczi wrote:
> + * Trace records are written out by a dedicated thread.  The thread waits for
> + * records to become available, writes them out, and then waits again.
> + */
> +static pthread_mutex_t trace_lock = PTHREAD_MUTEX_INITIALIZER;
> +static pthread_cond_t trace_available_cond = PTHREAD_COND_INITIALIZER;
> +static pthread_cond_t trace_empty_cond = PTHREAD_COND_INITIALIZER;
> +static bool trace_available;
> +static bool trace_writeout_enabled;

Please use QemuThread.

> +
> +    pthread_attr_init(&attr);
> +    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
>
> -    tp = find_trace_event_by_name(tname);
> -    if (tp) {
> -        tp->state = tstate;
> -        return true;
> +    sigfillset(&set);
> +    pthread_sigmask(SIG_SETMASK, &set, &oldset);
> +    ret = pthread_create(&thread, &attr, writeout_thread, NULL);
> +    pthread_sigmask(SIG_SETMASK, &oldset, NULL);

This is also taken care of by QemuThread.

Paolo

  reply	other threads:[~2011-02-27 15:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-27 14:58 [Qemu-devel] [PATCH] simpletrace: Thread-safe tracing Stefan Hajnoczi
2011-02-27 15:13 ` Paolo Bonzini [this message]
2011-02-27 17:02   ` [Qemu-devel] " Stefan Hajnoczi
2011-02-27 18:16     ` Paolo Bonzini
2011-02-28  9:35       ` Stefan Hajnoczi
2011-02-27 16:14 ` [Qemu-devel] " Avi Kivity
2011-02-27 17:06   ` Stefan Hajnoczi

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=4D6A6A08.8000300@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=prerna@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.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 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).