NAME

Thread::Csp::Channel - Channels for Communicating sequential processes

VERSION

version 0.003

SYNOPSIS

my $c = Thread::Csp::Channel->new;

$c->send("value");

my $rec = $c->receive;

DESCRIPTION

This class represents a channel between two or more CSP threads, allowing any cloneable value (unblessed values, channels and potentially others) to be passed around between threads.

METHODS

new()

This creates a new channel.

send($value)

This sends a value over the channel. It will block until another thread is prepared to receive the value.

receive()

This receives a value from the channel. It will block until another thread is prepared to send the value.

set_notify($handle, $value)

This will cause $value to be written to $handle whenever a new value becomes available, unless it's already being read. THIS METHOD IS PARTICULARLY EXPERIMENTAL.

close()

This will close the queue. Any receive will now return undef, and any write is ignored.

AUTHOR

Leon Timmermans <leont@cpan.org>

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.