The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Thread::Csp::Promise - Promises for thread return values.

VERSION

version 0.003

SYNOPSIS

 my $promise = Thread::Csp->spawn('Module', 'Module::function', $input, $output);
 $promise->get;

DESCRIPTION

This represents the return value of a thread, as return by spawn. This class is highly experimental and may disappear in the future.

METHODS

get()

This waits for the thread to finish, and will either return its value, or throw the exception that it died with. It may be called any number of times.

is_finished()

This returns true if the promise is finished.

set_notify($handle, $value)

This will cause $value to be written to $handle when the promise finishes, unless it's already being waited upon.

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.