From: Darren Hart <dvhltc@us.ibm.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: RT <linux-rt-users@vger.kernel.org>
Subject: Re: Breaking out of pthread_mutex_lock
Date: Fri, 30 May 2008 14:57:13 +0000 [thread overview]
Message-ID: <1212159433.14713.104.camel@Aeon> (raw)
In-Reply-To: <20080529164650.4d1be605@extreme>
On Thu, 2008-05-29 at 16:46 -0700, Stephen Hemminger wrote:
> On Thu, 29 May 2008 23:41:55 +0000
> Darren Hart <dvhltc@us.ibm.com> wrote:
>
> > I find I need to be able to break out of the blocked state while waiting
> > to acquire a pthread_mutex. I'm using PI mutexes and want to continue
> > to do so. As I understand it, I can't use a signal to break out of the
> > lock as the man pages states:
> >
> > "If a signal is delivered to a thread waiting for a mutex, upon return
> > from the signal handler the thread shall resume waiting for the mutex
> > as if it was not interrupted."
> >
> > and that pthread_mutex_lock will not return EINTR. I had considered
> > using cond variables, but I don't think they will provide the same PI
> > behavior (since the threads are not blocked on the mutex while awaiting
> > the pthread_cond_signal - right?).
> >
> > I'm sure I'm not the first to want to do this, does anyone know of a
> > common best practice for accomplishing such a thing?
> >
>
> setjmp/longjmp?
Stephen,
Hrmm... I confess to not having made use of them before. I read up a
bit, and don't see right off how they would help in this situation. I
assume you're suggesting the longjmp be used in a signal handler while
the thread is blocked on the mutex - where would it jump to, and how
would I ensure the integrity of the pthread_mutex structure (which
thinks my thread is waiting for it) ?
--
Darren Hart
Real-Time Linux Team
IBM Linux Technology Center
next prev parent reply other threads:[~2008-05-30 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 23:41 Breaking out of pthread_mutex_lock Darren Hart
2008-05-29 23:46 ` Stephen Hemminger
2008-05-30 14:57 ` Darren Hart [this message]
2008-05-30 15:24 ` Clark Williams
2008-06-02 11:36 ` Gilles Carry
2008-05-30 8:58 ` Gilles Carry
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=1212159433.14713.104.camel@Aeon \
--to=dvhltc@us.ibm.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=shemminger@vyatta.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.