threads - Perl extension allowing use of interpreter based threads from perl
use threads; sub start_thread { print "Thread started\n"; } my $thread = threads->new("start_thread","argument"); $thread->new(sub { print "I am a thread"},"argument"); $thread->join(); $thread->detach();
Perl 5.6 has something called interpreter threads, interpreter threads are built on MULTIPLICITY and allows for several different perl interpreters to run in different threads. This has been used in win32 perl to fake forks, it has also been avaible to people embedding perl.
I came across a situation where I needed a global cache of data and multiple threads working on a set of data using the cache for non changing data, so I decided to expose threadss to the perl level, that is were we realy need them.
threads are a bit different from what people normall thing of as threads, these threads do not share any memory at all, in the future it will be possible to explicitly share data.
please join perl-ithreads@perl.org for more information
Artur Bergman <lt>artur at contiller.se<gt>
threads is released under the same license as Perl
Thanks to
Richard Soderberg <lt>rs at crystalflame.net<gt> Helping me out tons, trying to find reasons for races and other wierd bugs!
Simon Cozens <lt>simon at brecon.co.uk<gt> Being there to answer zillions of annoying questions
Rocco Caputo <lt>troc at netrus.net<gt>
Plenty of bugs!
perl, perlcall, perlembed, perlguts
To install threads, copy and paste the appropriate command in to your terminal.
cpanm
cpanm threads
CPAN shell
perl -MCPAN -e shell install threads
For more information on module installation, please visit the detailed CPAN module installation guide.