Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Multi-Threading in Perl

by edebill (Scribe)
on Dec 26, 2001 at 07:17 UTC ( [id://134340]=note: print w/replies, xml ) Need Help??


in reply to Re: Multi-Threading in Perl
in thread Multi-Threading in Perl

Why is there a need for some 'threading' mechanism in Perl whereas it already has the 'fork' call?

It's hard to share data structures across a fork().

Yes, you can always get the job done using shared files, signals, pipes and such. But for some things it's just a lot more clean to pthread_mutex_lock(), change a variable, and pthread_mutex_unlock(). And select() loops are just obnoxious compared to having a separate thread or process to handle each incoming network connection (as long as you're not expecting super high performance with lots of clients)

Perl's threading works nicely - but it doesn't port to every platform perl does. This has caused me to rewrite at least one app which was originally started in perl using C. Good thing I "planned to throw one away".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://134340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 17:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found