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

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

Thread Previous | Thread Next
Gurusamy Sarathy
July 9, 2001 06:44
Re: [@11222] cannot compile -Duseithreads on freebsd-current
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About