Thread::Tie::Thread(3) create threads for tied variables

SYNOPSIS


use Thread::Tie; # use as early as possible for maximum memory savings
my $tiethread = Thread::Tie::Thread->new;
tie stuff, 'Thread::Tie', {thread => $thread};
my $tid = $tiethread->tid; # thread id of tied thread
my $thread = $tiethread->thread; # actual "threads" thread
$tiethread->shutdown; # shut down specific thread

DESCRIPTION

                  *** A note of CAUTION ***
 This module only functions on Perl versions 5.8.0 and later.
 And then only when threads are enabled with -Dusethreads.  It
 is of no use with any version of Perl before 5.8.0 or without
 threads enabled.
                  *************************

The Thread::Tie::Thread module is a helper class for the Thread::Tie module. It is used to create the thread in which the actual code, to which variables are tied with the Thread::Tie class, is located.

Please see the documentation of the Thread::Tie module for more information.

CLASS METHODS

There is only one class method.

new

 my $tiethread = Thread::Tie::Thread->new;

The ``new'' class method returns an instantiated object that can be specified with the ``thread'' field when tie()ing a variable.

OBJECT METHODS

The following object methods are available for the instantiated Thread::Tie::Thread object.

tid

 my $tid = $tiethread->tid;

The ``tid'' object method returns the thread id of the actual threads thread that is being used.

thread

 my $thread = $tiethread->thread;

The ``thread'' object method returns the actual threads thread object that is being used.

OPTIMIZATIONS

This module uses AutoLoader to reduce memory and CPU usage. This causes subroutines only to be compiled in a thread when they are actually needed at the expense of more CPU when they need to be compiled. Simple benchmarks however revealed that the overhead of the compiling single routines is not much more (and sometimes a lot less) than the overhead of cloning a Perl interpreter with a lot of subroutines pre-loaded.

AUTHOR

Elizabeth Mattijsen, <[email protected]>.

Please report bugs to <[email protected]>.

COPYRIGHT

Copyright (c) 2002-2003 Elizabeth Mattijsen <[email protected]>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.