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

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

Thread Previous | Thread Next
From:
Artur Bergman
Date:
July 9, 2001 06:53
Subject:
Re: [@11222] cannot compile -Duseithreads on freebsd-current
Message ID:
B76F83CB.20AF%artur@contiller.se
01-07-09 15.44, skrev Gurusamy Sarathy på gsar@ActiveState.com följande:

> 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.

Ofcourse, such is the mess of forking under threads.

>> 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.
> 

But it would let us run on bad pthread platforms, and it would solve the
PMOP problem ;). I meant it more as an excersie that might be usefull.

Artur


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