summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/ext/Thread/Thread/Specific.pm
blob: a6271a4ae4d1226aeb5a85abeb1bf97991e6e531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Thread::Specific;

=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;
OpenPOWER on IntegriCloud