Debian Codegraph @

README

raw
1 NAME
2
3 Future::XS - experimental XS implementation of Future
4
5 SYNOPSIS
6
7 my $future = Future::XS->new;
8
9 perform_some_operation(
10 on_complete => sub {
11 $future->done( @_ );
12 }
13 );
14
15 $future->on_ready( sub {
16 say "The operation is complete";
17 } );
18
19 DESCRIPTION
20
21 This module provides an XS-based implementation of the Future class. It
22 is currently experimental and shipped in its own distribution for
23 testing purposes, though once it seems stable the plan is to move it
24 into the main Future distribution and load it automatically in favour
25 of the pureperl implementation on supported systems.
26
27 Future::XS and threads
28
29 In a program not involving multiple threads, this module behaves
30 entirely as expected, following the behaviour of the regular pure-perl
31 Future implementation (regardless of whether or not the perl
32 interpreter is actually built to support threads).
33
34 When multiple threads are created, previous versions of this module
35 would most likely crash. The current version (0.10) fixes enough of the
36 logic, that future instances that are only ever accessed from one
37 thread (either the initial main thread, or any additional sidecar
38 threads) will work fine. However, future instances cannot currently
39 cross the boundary between threads. Any instances that were created
40 before a new thread is made will no longer be accessible within that
41 thread, and instances may not be returned as the result of the thread
42 exit value. Some of these restrictions may be relaxed in later
43 versions.
44
45 Attempts to access a future instance created in one thread from another
46 thread will raise an exception:
47
48 Future::XS instance IO::Async::Future=SCALAR(0x...) is not available in this thread at ...
49
50 As a special case for process cleanup activities, the ->cancel method
51 does not throw this exception, but simply returns silently. This is
52 because cleanup code such as DESTROY methods or defer blocks often
53 attempt to call this on existing instances.
54
55 AUTHOR
56
57 Paul Evans <[email protected]>
58