Re: Obscure mutex problem
- From: David Given <dg@xxxxxxxxxxx>
- Date: Thu, 06 Sep 2007 23:59:18 +0100
Rainer Weikusat wrote:
[...]
I do not quite understand why this would be regarded as
'inflammatory'. It's a technical fact. How can one get upset about
this? And I neither wrote about you-the-person nor did I mean to.
Unfortunately that turns out not to be the case. You accused me of
'perpetuating a stupid myth', which is strongly coloured and can be read as
implying that I'm doing it out of maliciousness. Part of the perils of a
text-only medium is there being no tone of voice --- I learnt the hard why why
it's always important to use moderate language for *everything* because it's
far too easy to be misread...
On the other hand, I have had one discussion with a 'NT-kiddie'
running around and telling everyone that 'Linux is inferior because it
does not support threads, but only processes', which had absolutely no
clue about anything, and I don't need another.
I entirely sympathise.
[...]
A guess would be that some thread locks the mutex before daemon forks
and because this thread isn't the one executing the fork, the locked
mutex in the child can never be unlocked again. At least that's the
specified behaviour. 'Some NPTL versions' support unlocking
mutexes from arbitrary threads, though.
I bet this is it. daemon(), of course, sneakily does a fork() behind the
scenes where it's not obvious. The *old* spey coroutine support, built with
getcontext()/setcontext(), didn't need mutexes and ran in a single thread, and
so wasn't affected by this.
I'm a little surprised that fork() doesn't duplicate the mutex along with the
rest of the process, though; it is, after all, no longer being allocated with
PTHREAD_PROCESS_SHARED, and so should be private. Unless the thread libraries
on which it is failing happen to share mutexes by default, of course... hmm.
Nevertheless, I shall rearrange the code and see what happens. Thanks very
much. I'll report back if it works or not.
--
┌── dg@cowlark.com ─── http://www.cowlark.com ───────────────────
│
│ "There does not now, nor will there ever, exist a programming language in
│ which it is the least bit hard to write bad programs." --- Flon's Axiom
.
- Follow-Ups:
- Re: Obscure mutex problem
- From: David Schwartz
- Re: Obscure mutex problem
- References:
- Obscure mutex problem
- From: David Given
- Re: Obscure mutex problem
- From: Rainer Weikusat
- Re: Obscure mutex problem
- From: David Given
- Re: Obscure mutex problem
- From: Rainer Weikusat
- Obscure mutex problem
- Prev by Date: Re: Obscure mutex problem
- Next by Date: Re: Obscure mutex problem
- Previous by thread: Re: Obscure mutex problem
- Next by thread: Re: Obscure mutex problem
- Index(es):
Relevant Pages
|