linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>
To: "David A. Gatwood" <dgatwood@deepspace.mklinux.org>
Cc: khendricks@ivey.uwo.ca, linuxppc-dev@lists.linuxppc.org
Subject: Re: Another signal handling bug?
Date: Thu, 17 Aug 2000 19:03:25 -0400	[thread overview]
Message-ID: <399C6F3D.1CFE185E@sympatico.ca> (raw)
In-Reply-To: Pine.LNX.3.96.1000817193728.8005E-100000@deepspace.mklinux.org


Hi David,

> > 2.  You should techically always be calling async signal safe routines
> > frominside any signal handlers.  Grabbing a mutex lock is not one of these.
>
> Wait a sec... how can taking a lock be an atomic operation, but not async
> signal safe?  That seems a little odd.

Here is what the pthread_mutex_lock page says:

ASYNC-SIGNAL SAFETY
       The mutex functions are not async-signal safe.  What  this
       means is that they should not be called from a signal han<AD>
       dler.  In  particular,   calling   pthread_mutex_lock   or
       pthread_mutex_unlock  from  a  signal handler may deadlock
       the calling thread.

You have already experienced the deadlock problem first hand!

If you use a spinlock and keep track of the current owner you can implement a
simple mutex with recursion allowed and possibly get away with it but in
general, using mutexes in signal handlers are a big no-no.

Kevin

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2000-08-17 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-17  5:44 Another signal handling bug? David A. Gatwood
2000-08-17  6:15 ` David A. Gatwood
2000-08-17  6:26   ` David A. Gatwood
2000-08-18  2:08     ` David A. Gatwood
2000-08-17 22:28       ` Kevin B. Hendricks
2000-08-18  2:46         ` David A. Gatwood
2000-08-17 23:03           ` Kevin B. Hendricks [this message]
2000-08-18  3:26             ` David A. Gatwood
2000-08-17 23:07           ` Kevin B. Hendricks
2000-08-18  3:28             ` David A. Gatwood

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=399C6F3D.1CFE185E@sympatico.ca \
    --to=kevin.hendricks@sympatico.ca \
    --cc=dgatwood@deepspace.mklinux.org \
    --cc=khendricks@ivey.uwo.ca \
    --cc=linuxppc-dev@lists.linuxppc.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).