DiaColloDB::threads - wrapper for threads.pm or forks.pm
##======================================================================== ## PRELIMINARIES use DiaColloDB::threads; $module = $DiaColloDB::threads::MODULE; $tid = DiaColloDB::threads->tid(); if ($DiaColloDB::threads::MODULE) { ##-- you can use the threads API my $thr = threads->create(\&callback,@args); my $rc = $thr->join(); #... etc. }
The DiaColloDB::threads module attempts to load (pseudo)-thread support from either threads.pm or forks.pm, depending on whether or not your perl has builtin thread support according to $Config{usethreads}. It also wraps the import() method of whatever module it actually loads, so it should work as a drop-in replacement for whatever threads-like module you have available.
DiaColloDB::threads
$Config{usethreads}
import()
threads
After using DiaColloDB::threads, the variable $DiaColloDB::threads::MODULE is set to the name of the module providing the underlying threads implementation (either threads or forks), if any. Otherwise, it is set to the empty string.
$DiaColloDB::threads::MODULE
forks
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2020 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
DiaColloDB::threads::shared(3pm), threads(3pm), forks(3pm), perl(1), ...
To install DiaColloDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DiaColloDB
CPAN shell
perl -MCPAN -e shell install DiaColloDB
For more information on module installation, please visit the detailed CPAN module installation guide.