qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: "M. Warner Losh" <imp@bsdimp.com>
Cc: kvm-devel@lists.sourceforge.net, glommer@gmail.com,
	qemu-devel@nongnu.org, chrisw@sous-sol.org, gcosta@redhat.com
Subject: Re: [Qemu-devel] [PATCH] use a thread id variable
Date: Sun, 9 Mar 2008 20:01:54 +0000	[thread overview]
Message-ID: <20080309200154.GA16225@shareable.org> (raw)
In-Reply-To: <20080309.100911.844330500.imp@bsdimp.com>

M. Warner Losh wrote:
> In message: <20080309115826.GA8077@shareable.org>
>             Jamie Lokier <jamie@shareable.org> writes:
> : Btw, unfortunately pthread_self() is not safe to call from signal
> : handlers.
> 
> And also often times meaningless, as signal handlers can run in
> arbitrary threads...

That's usually the case, but sometimes it is useful.  Some causes of
signals are thread specific, or can be asked to be, and it's nice to
know which thread is receiving them (e.g. thread specific timers,
SIGIOs, write-protection SEGVs, and even sending messages with good
old pthread_kill (same reason as kernel uses IPIs)).

GCC's Boehm garbage collector uses pthread_self() from a signal
handler.  I've used gettid() in a signal handler on a few occasions.


-- Jamie

  reply	other threads:[~2008-03-09 20:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 20:01 [Qemu-devel] [PATCH 0/3] Expose thread id through info cpus Glauber Costa
2008-03-05 20:01 ` [Qemu-devel] [PATCH] use a thread id variable Glauber Costa
2008-03-05 20:01   ` [Qemu-devel] [PATCH] augment info cpus Glauber Costa
2008-03-05 20:01     ` [Qemu-devel] [PATCH] KVM: use actual thread id for vcpus Glauber Costa
2008-03-09  9:26   ` [Qemu-devel] [PATCH] use a thread id variable Gilad Ben-Yossef
2008-03-09 11:58     ` Jamie Lokier
2008-03-09 14:52       ` Gilad Ben-Yossef
2008-03-09 16:12         ` M. Warner Losh
2008-03-17 17:55         ` Glauber Costa
2008-03-09 16:09       ` M. Warner Losh
2008-03-09 20:01         ` Jamie Lokier [this message]
2008-03-09 16:23     ` [kvm-devel] " Daniel P. Berrange
2008-03-05 20:07 ` [Qemu-devel] Re: [PATCH 0/3] Expose thread id through info cpus Glauber Costa
2008-03-06  6:55 ` Avi Kivity

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=20080309200154.GA16225@shareable.org \
    --to=jamie@shareable.org \
    --cc=chrisw@sous-sol.org \
    --cc=gcosta@redhat.com \
    --cc=glommer@gmail.com \
    --cc=imp@bsdimp.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --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).