NAME

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

VERSION

version 0.008

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.

receive_ready_fh()

This will return a filehandle that one byte will be written to when a value has been send to the channel.

send_ready_fh()

This will return a filehandle that one byte will be written to when a value is being received.

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.