public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
From: Will Bryant <will.bryant@ecosm.com>
To: Bastian Voigt <bastian@voigt.in-berlin.de>,
	 pthreads-win32@sources.redhat.com
Subject: Re: calling mutex_lock() twice from one thread
Date: Wed, 17 Nov 2004 06:11:00 -0000	[thread overview]
Message-ID: <419AEB9A.1060709@ecosm.com> (raw)
In-Reply-To: <419888D2.3060502@voigt.in-berlin.de>

Bastian Voigt wrote:

> The main thread loads some configuration, then starts some worker 
> threads. After the worker threads are running I want the main thread 
> to sleep until a signal (Ctrl-C) arrives. Will it work better when 
> using semaphores?

Yes, aside from the fact that you want non-recursive locks, semaphores 
are the _only_ synchronization primitive that can be used from inside 
signal handlers.  Note that condition variables most definitely cannot 
be signalled from inside a signal handler - that will break - badly - on 
most unix platforms.

-- 
Will Bryant
Systems Architect, eCOSM.
Phone +64 3 365 4176 | Mobile +64 21 655 443
http://www.ecosm.com/

  parent reply	other threads:[~2004-11-17  6:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-15 10:47 Bastian Voigt
2004-11-15 11:09 ` Nicolas EDEL
2004-11-17  6:11 ` Will Bryant [this message]
2004-11-17  7:51   ` Bastian Voigt

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=419AEB9A.1060709@ecosm.com \
    --to=will.bryant@ecosm.com \
    --cc=bastian@voigt.in-berlin.de \
    --cc=pthreads-win32@sources.redhat.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 read-only IMAP folder(s) and NNTP newsgroup(s).