develooper Front page | perl.perl5.porters | Postings from July 2001

Re: [@11222] cannot compile -Duseithreads on freebsd-current

Thread Previous | Thread Next
From:
Gurusamy Sarathy
Date:
July 9, 2001 06:44
Subject:
Re: [@11222] cannot compile -Duseithreads on freebsd-current
Message ID:
200107091344.f69Di1f32650@smtp3.ActiveState.com
On Mon, 09 Jul 2001 12:37:08 +0200, Artur Bergman wrote:
>Aside from the fact that freebsd realy ought to have a working
>pthread_atfork, can't we just make sure the mutexes per process and thus the
>two forks would not share mutexes?

There is no sharing of mutexes going on.  The need for pthread_atfork()
is more of a fundamental problem in "cloning" a parent with multiple
threads into a single-threaded child.  Some thread that is not cloned
in the child may be holding a mutex in the parent, which means the
(duped) mutex in the child will appear to be held to the only thread
in the child.  This thread in the child will deadlock because there
is no other thread to release the mutex.  I suggest reading the man page
for pthread_atfork() if that is unclear.

>On another note, it is possible to implment the current threads scheme by
>using fork() and mmap (on unix systems that is), anyone want to try :)

IMHO, this belongs in a pthreads library, not perl.  In fact, I hear
a few pthreads implementations (esp. on platforms with no kernel
threads) are done this way.


Sarathy
gsar@ActiveState.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About