The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

threads - Perl extension allowing use of interpreter based threads from perl

SYNOPSIS

  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();

DESCRIPTION

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

TODO

Fix so the return value is returned when you join
Add join_all
Fix memory handling!

AUTHOR and COPYRIGHT

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>

BUGS

creating a thread from within a thread is unsafe under win32

Plenty of bugs!

SEE ALSO

perl, perlcall, perlembed, perlguts