diff options
author | Artur Bergman <sky@nanisky.com> | 2001-06-19 00:06:37 +0200 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-18 22:34:06 +0000 |
commit | f2fc0a4050ac9234cb4e9b7764656b322cb30135 (patch) | |
tree | 416fc1744eb400f0a3ae127a2b6684e4f66138e6 /pod/perlmod.pod | |
parent | f970f0fc9b8808d7f48ea934d252da2e6103af68 (diff) | |
download | perl-f2fc0a4050ac9234cb4e9b7764656b322cb30135.tar.gz |
Documentation changes for CLONE
Message-ID: <B7542BEC.1719%artur@contiller.se>
p4raw-id: //depot/perl@10694
Diffstat (limited to 'pod/perlmod.pod')
-rw-r--r-- | pod/perlmod.pod | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pod/perlmod.pod b/pod/perlmod.pod index 01056f1d98..29ad67cb12 100644 --- a/pod/perlmod.pod +++ b/pod/perlmod.pod @@ -443,6 +443,23 @@ the module. It is the responsibility of the F<.pm> file to load although the POSIX module happens to do both dynamic loading and autoloading, the user can say just C<use POSIX> to get it all. +=head2 Making your module threadsafe + +Perl has since 5.6.0 support for a new type of threads called +interpreter threads. These threads can be used explicitly and implicitly. + +Ithreads work by cloning the data tree so that no data is shared +between different threads. These threads can be used using the threads +module or by doing fork() on win32 (fake fork() support). When a thread is +cloned all perl data is cloned, however non perl data cannot be cloned. +Perl after 5.7.2 has support for the C<CLONE> keyword. C<CLONE> will be +executed once for every package that has it defined (or inherits it). +It will be called in the context of the new thread, so all modifications +are made in the new area. + +If you want to CLONE all objects you will need to keep track of them per +package. This is simply done using a hash and Scalar::Util::weaken(). + =head1 SEE ALSO See L<perlmodlib> for general style issues related to building Perl |