LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File perl-Thread-Queue.spec of Package perl-Thread-Queue (Project home:jayvdb:autotools)

#
# spec file for package perl-Thread-Queue
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           perl-Thread-Queue
Version:        3.12
Release:        0
%define cpan_name Thread-Queue
Summary:        Thread-safe queues
License:        Artistic-1.0 or GPL-1.0+
Group:          Development/Libraries/Perl
Url:            http://search.cpan.org/dist/Thread-Queue/
Source0:        https://cpan.metacpan.org/authors/id/J/JD/JDHEDDEN/%{cpan_name}-%{version}.tar.gz
Source1:        cpanspec.yml
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  perl
BuildRequires:  perl-macros
BuildRequires:  perl(threads::shared) >= 1.21
Requires:       perl(threads::shared) >= 1.21
%{perl_requires}

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

Any data types supported by threads::shared 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 Thread::Queue 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 "LIMITATIONS" for caveats related to passing objects via queues.

%prep
%setup -q -n %{cpan_name}-%{version}

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}

%check
%{__make} test

%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist

%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes examples README

%changelog