NAME
Thread::GoChannel - Fast thread queues with go-like semantics
VERSION
version 0.004
SYNOPSIS
use
threads;
use
Thread::GoChannel;
my
$channel
= Thread::GoChannel->new;
my
$reader
= threads->create(
sub
{
while
(
my
$line
= <>) {
$channel
->
send
(
$line
)
}
$channel
->
close
;
});
while
(
defined
(
my
$line
=
$channel
->receive)) {
$line
;
}
$reader
->
join
;
DESCRIPTION
Thread::GoChannel is an alternative to Thread::Queue. By using a smart duplication instead of serialization it can achieve high performance without compromising on flexibility.
METHODS
new()
This constructs a new channel.
send($message)
This sends the message $message
to the channel. It will wait until there is a receiver.
receive()
Received a message from the channel, it will wait until a message arrives, or return undef if the channel is closed.
close()
Closes the channel for further messages.
SEE ALSO
Thread::Queue
Thread::Channel
AUTHOR
Leon Timmermans <fawaka@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021 by Leon Timmermans.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.