|
|
What this is
This file is included in the DevDaily.com
"Perl Source Code
Warehouse" project. The intent of this project is to help you "Learn
Perl by Example" TM.
Other links
The source code
package Thread;
use strict;
our($VERSION, $ithreads, $othreads);
BEGIN {
$VERSION = '2.00';
use Config;
$ithreads = $Config{useithreads};
$othreads = $Config{use5005threads};
}
require Exporter;
use XSLoader ();
our(@ISA, @EXPORT, @EXPORT_OK);
@ISA = qw(Exporter);
BEGIN {
if ($ithreads) {
@EXPORT = qw(cond_wait cond_broadcast cond_signal)
} elsif ($othreads) {
@EXPORT_OK = qw(cond_signal cond_broadcast cond_wait);
}
push @EXPORT_OK, qw(async yield);
}
=head1 NAME
Thread - manipulate threads in Perl (for old code only)
=head1 CAVEAT
Perl has two thread models.
In Perl 5.005 the thread model was that all data is implicitly shared
and shared access to data has to be explicitly synchronized.
This model is called "5005threads".
In Perl 5.6 a new model was introduced in which all is was thread
local and shared access to data has to be explicitly declared.
This model is called "ithreads", for "interpreter threads".
In Perl 5.6 the ithreads model was not available as a public API,
only as an internal API that was available for extension writers,
and to implement fork() emulation on Win32 platforms.
In Perl 5.8 the ithreads model became available through the C
module.
Neither model is configured by default into Perl (except, as mentioned
above, in Win32 ithreads are always available.) You can see your
Perl's threading configuration by running C and looking for
the I variables, or inside script by C
|