Plan 9 from Bell Labs’s /usr/web/sources/contrib/gabidiaz/root/sys/src/cmd/perl/ext/Thread/Thread/Specific.pm

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


package Thread::Specific;

our $VERSION = '1.00';

=head1 NAME

Thread::Specific - thread-specific keys

=head1 SYNOPSIS

    use Thread::Specific;
    my $k = key_create Thread::Specific;

=head1 DESCRIPTION

C<key_create> returns a unique thread-specific key.

=cut

sub import : locked : method {
    require fields;
    fields::->import(@_);
}	

sub key_create : locked : method {
    our %FIELDS;   # suppress "used only once"
    return ++$FIELDS{__MAX__};
}

1;

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.