On Fri, 04 May 2001 15:05:53 BST, Alan Burlison wrote:
>Artur Bergman wrote:
>> The iThread module now works in creating and joining in threads, however the
>> interesting issue is sharing variables between interpreters (otherwise we
>> just have fork...);
>
>I don't want to rain on your parade, but as long as perl continues to use
>setjmp/longjmp or variants thereof, you are doomed to failure.  I've said
>this repeatedly, and people don't seem to want to hear:
>
>SETJMP AND LONGJMP ARE USED EXTENSIVELY IN PERL5.  SETJMP AND LONGJMP ARE
>NOT MT-SAFE.  YOU ARE WASTING YOUR TIME TRYING TO PUT MULTITHREADING INTO
>PERL5 AS IT STANDS.  EVEN IF IT WORKS MOST OF THE TIME ON YOUR UNIPROCESSOR
>MACHINE IT WILL EXPLODE IN YOUR FACE ON A MULTIPROCESSOR MACHINE.  THREADS
>IN PERL5 ARE DOOMED TO FAILURE WITHOUT SIGNIFICANT REARCHITECTING.

If you're worried about holding locks when a longjmp() is called by
perl, rest assured that perl itself doesn't hold any locks when calling
longjmp() under USE_ITHREADS.  The only mutex perl uses under USE_ITHREADS
is PL_op_mutex, which is only held while a variable is inc/decremented.
This can never call longjmp().

(Then there's also PL_malloc_mutex, which is only used with usemymalloc=y,
and perl never longjmp()s while holding it.)

While I appreciate why you might want to scream and beat the bushes about
this, I think it is unjustified in this case.


Sarathy
[EMAIL PROTECTED]

Reply via email to