Thread::IsolateThread::Isolate is a Perl module used to create threads that can be called externally and use them to isolate modules... | |
Download |
Thread::Isolate Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Graciliano M. P.
- Publisher web site:
- http://search.cpan.org/~gmpassos/
Thread::Isolate Tags
Thread::Isolate Description
Thread::Isolate is a Perl module used to create threads that can be called externally and use them to isolate modules... Thread::Isolate is a Perl module used to create threads that can be called externally and use them to isolate modules from the main thread.This module has the main purpose to isolate loaded modules from the main thread.The idea is to create the Thread::Isolate object and call methods, evaluate codes and use modules inside it, with synchronized and unsynchronized calls.Also you can have multiple Thread::Isolate objects, with different states of the Perl interpreter (different loaded modules in each thread).To save memory Thread::Isolate holds a cleaner version of the Perl interpreter when it's loaded, than it uses this Mother Thread to create all the other Thread::Isolate objects.USAGESynchronized calls: ## Load it soon as possible to save memory: use Thread::Isolate ; my $thi = Thread::Isolate->new() ; $thi->eval(' 2**10 ') ; ... $thi->eval(q` sub TEST { my ( $var ) = @_ ; return $var ** 10 ; } `) ; print $thi->call('TEST' , 2) ; ... $thi->use('Data::Dumper') ; print $thi->call('Data::Dumper::Dumper' , ) ;Here's an example of an unsynchronized call (detached): my $job = $thi->eval_detached(q` for(1..5) { print "in> $_n" ; sleep(1); } return 2**3 ; `); $job->wait_to_start ; while( $job->is_running ) { print "." ; } print $job->returned ;Creating a copy of an already existent Thread::Isolate: ^ my $thi = Thread::Isolate->new() ; ## Creates a thread inside/from $thi and return it: $thi2 = $thi->new_internal ;The code above can be used to make different copies of different states of the Perl Interpreter. Requirements: · Perl
Thread::Isolate Related Software