use 5.007_003;
use strict;
use warnings;
+BEGIN {
+ require Exporter;
+ our @ISA = qw(Exporter);
+ our @EXPORT = qw(share cond_wait cond_broadcast cond_signal);
+ our $VERSION = '0.90';
-require Exporter;
-our @ISA = qw(Exporter);
-our @EXPORT = qw(share cond_wait cond_broadcast cond_signal);
-our $VERSION = '0.90';
-
-if ($threads::threads) {
+ if ($threads::threads) {
*cond_wait = \&cond_wait_enabled;
*cond_signal = \&cond_signal_enabled;
*cond_broadcast = \&cond_broadcast_enabled;
require XSLoader;
XSLoader::load('threads::shared',$VERSION);
-}
-else {
+ push @EXPORT,'bless';
+ }
+ else {
*share = \&share_disabled;
*cond_wait = \&cond_wait_disabled;
*cond_signal = \&cond_signal_disabled;
*cond_broadcast = \&cond_broadcast_disabled;
+ }
}
autovivify the elements, and neither does slicing a shared array/hash
over non-existent indices/keys autovivify the elements.
-share() allows you to C<share $hashref->{key}> without giving any error
-message. But the C<$hashref->{key}> is B<not> shared, causing the error
+share() allows you to C<< share $hashref->{key} >> without giving any error
+message. But the C<< $hashref->{key} >> is B<not> shared, causing the error
"locking can only be used on shared values" to occur when you attempt to
-C<lock $hasref->{key}>.
+C<< lock $hasref->{key} >>.
=head1 AUTHOR