home *** CD-ROM | disk | FTP | other *** search
/ PC World 2003 March / PCWorld_2003-03_cd.bin / Software / Topware / activeperl / ActivePerl / Perl / lib / Thread / Specific.pm < prev   
Encoding:
Perl POD Document  |  2002-06-19  |  499 b   |  31 lines

  1. package Thread::Specific;
  2.  
  3. our $VERSION = '1.00';
  4.  
  5. =head1 NAME
  6.  
  7. Thread::Specific - thread-specific keys
  8.  
  9. =head1 SYNOPSIS
  10.  
  11.     use Thread::Specific;
  12.     my $k = key_create Thread::Specific;
  13.  
  14. =head1 DESCRIPTION
  15.  
  16. C<key_create> returns a unique thread-specific key.
  17.  
  18. =cut
  19.  
  20. sub import : locked : method {
  21.     require fields;
  22.     fields::->import(@_);
  23. }    
  24.  
  25. sub key_create : locked : method {
  26.     our %FIELDS;   # suppress "used only once"
  27.     return ++$FIELDS{__MAX__};
  28. }
  29.  
  30. 1;
  31.