Thread-safe queues

Edit Package perl-Thread-Queue
http://search.cpan.org/dist/Thread-Queue/

This module provides thread-safe FIFO queues that can be accessed safely by
any number of threads.

Any data types supported by the threads::shared manpage can be passed via
queues:

* Ordinary scalars

* Array refs

* Hash refs

* Scalar refs

* Objects based on the above

Ordinary scalars are added to queues as they are.

If not already thread-shared, the other complex data types will be cloned
(recursively, if needed, and including any 'bless'ings and read-only
settings) into thread-shared structures before being placed onto a queue.

For example, the following would cause the Thread::Queue manpage to create
a empty, shared array reference via '&shared([])', copy the elements 'foo',
'bar' and 'baz' from '@ary' into it, and then place that shared reference
onto the queue:

my @ary = qw/foo bar baz/;
$q->enqueue(\@ary);

However, for the following, the items are already shared, so their
references are added directly to the queue, and no cloning takes place:

my @ary :shared = qw/foo bar baz/;
$q->enqueue(\@ary);

my $obj = &shared({});
$$obj{'foo'} = 'bar';
$$obj{'qux'} = 99;
bless($obj, 'My::Class');
$q->enqueue($obj);

See the /"LIMITATIONS" manpage for caveats related to passing objects via
queues.

Refresh
Refresh
Source Files
Filename Size Changed
Thread-Queue-3.13.tar.gz 0000015435 15.1 KB
cpanspec.yml 0000000469 469 Bytes
perl-Thread-Queue-use_lib.patch 0000003229 3.15 KB
perl-Thread-Queue.changes 0000002658 2.6 KB
perl-Thread-Queue.spec 0000002894 2.83 KB
Latest Revision
Stephan Kulow's avatar Stephan Kulow (coolo) accepted request 623553 from Stephan Kulow's avatar Stephan Kulow (coolo) (revision 9)
automatic update
Comments 0
openSUSE Build Service is sponsored by