SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

perl-threads rpm build for : OpenSuSE. For other distributions click perl-threads.

Name : perl-threads
Version : 2.21 Vendor : obs://build_opensuse_org/devel:languages:perl
Release : lp156.1.1 Date : 2024-07-03 19:18:29
Group : Development/Libraries/Perl Source RPM : perl-threads-2.21-lp156.1.1.src.rpm
Size : 0.11 MB
Packager : https://www_suse_com/
Summary : Perl interpreter-based threads
Description :
Since Perl 5.8, thread programming has been available using a model called
_interpreter threads_ which provides a new Perl interpreter for each
thread, and, by default, results in no data or state information being
shared between threads.

(Prior to Perl 5.8, _5005threads_ was available through the \'Thread.pm\'
API. This threading model has been deprecated, and was removed as of Perl
5.10.0.)

As just mentioned, all variables are, by default, thread local. To use
shared variables, you need to also load threads::shared:

use threads;
use threads::shared;

When loading threads::shared, you must \'use threads\' before you \'use
threads::shared\'. (\'threads\' will emit a warning if you do it the other way
around.)

It is strongly recommended that you enable threads via \'use threads\' as
early as possible in your script.

If needed, scripts can be written so as to run on both threaded and
non-threaded Perls:

my $can_use_threads = eval \'use threads; 1\';
if ($can_use_threads) {

...
} else {

...
}

* $thr = threads->create(FUNCTION, ARGS)

This will create a new thread that will begin execution with the specified
entry point function, and give it the _ARGS_ list as parameters. It will
return the corresponding threads object, or \'undef\' if thread creation
failed.

_FUNCTION_ may either be the name of a function, an anonymous subroutine,
or a code ref.

my $thr = threads->create(\'func_name\', ...);

my $thr = threads->create(sub { ... }, ...);

my $thr = threads->create(\\&func, ...);

The \'->new()\' method is an alias for \'->create()\'.

* $thr->join()

This will wait for the corresponding thread to complete its execution. When
the thread finishes, \'->join()\' will return the return value(s) of the
entry point function.

The context (void, scalar or list) for the return value(s) for \'->join()\'
is determined at the time of thread creation.


my ($thr1) = threads->create(sub {
my AATTresults = qw(a b c);
return (AATTresults);
});

my $thr1 = threads->create({\'context\' => \'list\'},
sub {
my AATTresults = qw(a b c);
return (AATTresults);
});

my AATTres1 = $thr1->join();


my $thr2 = threads->create(sub {
my $result = 42;
return ($result);
});

my $res2 = $thr2->join();


my $thr3 = threads->create({\'void\' => 1},
sub { print(\"Hello, world\
\"); });

$thr3->join();

See \"THREAD CONTEXT\" for more details.

If the program exits without all threads having either been joined or
detached, then a warning will be issued.

Calling \'->join()\' or \'->detach()\' on an already joined thread will cause
an error to be thrown.

* $thr->detach()

Makes the thread unjoinable, and causes any eventual return value to be
discarded. When the program exits, any detached threads that are still
running are silently terminated.

If the program exits without all threads having either been joined or
detached, then a warning will be issued.

Calling \'->join()\' or \'->detach()\' on an already detached thread will cause
an error to be thrown.

* threads->detach()

Class method that allows a thread to detach itself.

* threads->self()

Class method that allows a thread to obtain its own _threads_ object.

* $thr->tid()

Returns the ID of the thread. Thread IDs are unique integers with the main
thread in a program being 0, and incrementing by 1 for every thread
created.

* threads->tid()

Class method that allows a thread to obtain its own ID.

* \"$thr\"

If you add the \'stringify\' import option to your \'use threads\' declaration,
then using a threads object in a string or a string context (e.g., as a
hash key) will cause its ID to be used as the value:

use threads qw(stringify);

my $thr = threads->create(...);
print(\"Thread $thr started\
\"); # Prints: Thread 1 started

* threads->object($tid)

This will return the _threads_ object for the _active_ thread associated
with the specified thread ID. If \'$tid\' is the value for the current
thread, then this call works the same as \'->self()\'. Otherwise, returns
\'undef\' if there is no thread associated with the TID, if the thread is
joined or detached, if no TID is specified or if the specified TID is
undef.

* threads->yield()

This is a suggestion to the OS to let this thread yield CPU time to other
threads. What actually happens is highly dependent upon the underlying
thread implementation.

You may do \'use threads qw(yield)\', and then just use \'yield()\' in your
code.

* threads->list()

* threads->list(threads::all)

* threads->list(threads::running)

* threads->list(threads::joinable)

With no arguments (or using \'threads::all\') and in a list context, returns
a list of all non-joined, non-detached _threads_ objects. In a scalar
context, returns a count of the same.

With a _true_ argument (using \'threads::running\'), returns a list of all
non-joined, non-detached _threads_ objects that are still running.

With a _false_ argument (using \'threads::joinable\'), returns a list of all
non-joined, non-detached _threads_ objects that have finished running
(i.e., for which \'->join()\' will not _block_).

* $thr1->equal($thr2)

Tests if two threads objects are the same thread or not. This is overloaded
to the more natural forms:

if ($thr1 == $thr2) {
print(\"Threads are the same\
\");
}

if ($thr1 != $thr2) {
print(\"Threads differ\
\");
}

(Thread comparison is based on thread IDs.)

* async BLOCK;

\'async\' creates a thread to execute the block immediately following it.
This block is treated as an anonymous subroutine, and so must have a
semicolon after the closing brace. Like \'threads->create()\', \'async\'
returns a _threads_ object.

* $thr->error()

Threads are executed in an \'eval\' context. This method will return \'undef\'
if the thread terminates _normally_. Otherwise, it returns the value of
\'$AATT\' associated with the thread\'s execution status in its \'eval\' context.

* $thr->_handle()

This _private_ method returns a pointer (i.e., the memory location
expressed as an unsigned integer) to the internal thread structure
associated with a threads object. For Win32, this is a pointer to the
\'HANDLE\' value returned by \'CreateThread\' (i.e., \'HANDLE *\'); for other
platforms, it is a pointer to the \'pthread_t\' structure used in the
\'pthread_create\' call (i.e., \'pthread_t *\').

This method is of no use for general Perl threads programming. Its intent
is to provide other (XS-based) thread modules with the capability to
access, and possibly manipulate, the underlying thread structure associated
with a Perl thread.

* threads->_handle()

Class method that allows a thread to obtain its own _handle_.

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/x86_64

Content of RPM  Provides Requires

Download
ftp.icm.edu.pl  perl-threads-2.21-lp156.1.1.x86_64.rpm
     

Provides :
perl(threads)
perl-threads
perl-threads(x86-64)

Requires :
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.32)(64bit)
libc.so.6(GLIBC_2.34)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
perl(:MODULE_COMPAT_5.26.1)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi/auto/threads
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi/auto/threads/threads.so
/usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi/threads.pm
/usr/share/doc/packages/perl-threads
/usr/share/doc/packages/perl-threads/Changes
/usr/share/doc/packages/perl-threads/README
/usr/share/doc/packages/perl-threads/examples
/usr/share/doc/packages/perl-threads/examples/pool.pl
/usr/share/doc/packages/perl-threads/examples/pool_reuse.pl
/usr/share/man/man3/threads.3pmc.gz

 
ICM