NAME

DiaColloDB::threads - wrapper for threads.pm or forks.pm

SYNOPSIS

##========================================================================
## 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.
}

DESCRIPTION

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.

Gloabls

Variable: $MODULE

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.

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

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.

SEE ALSO

DiaColloDB::threads::shared(3pm), threads(3pm), forks(3pm), perl(1), ...