1Pipeline::Segment::AsynUcs(e3r)Contributed Perl DocumentPaitpieolnine::Segment::Async(3)
2
3
4
6 Pipeline::Segment::Async - asynchronous pipeline segments
7
9 my $seg = $pipe->store->get( $async_segment_classname );
10 my $ret = $seg->reattach();
11
13 The "Pipeline::Segment::Async" module allows you to write asynchronous
14 pipeline segments. Whenever an asynchronous segment is dispatched it
15 places itself in the store, and splits away from the main process that
16 keeps running. At any point furthe down the pipeline you can request
17 the segment from the store, and then ask it to give you back its return
18 values by calling the "reattach()" method, or even, throw them away by
19 calling "discard()" which will simply destroy the segment when it
20 completes. If you call "discard()" there is no way you can get it
21 back.
22
23 You add any asynchronous segment to the a pipeline in exactly the same
24 manner you would add any other segment. It gets dispatched in the
25 normal way, with the normal arguments supplied to the dispatch method.
26 Getting objects from the store will retrieve them as expected. however
27 altering those objects or setting them back into the store will not do
28 what you expect.
29
30 "Pipeline::Segment::Async" works by indicating to the dispatcher that
31 it wants a different method to be its dispatch method. If you indicate
32 to the dispatcher that you want something to dispatch different at the
33 segment level, then your asynchronous segment will be come decidedly
34 synchronous.
35
36 "Pipeline::Segment::Async" inherits from "Pipeline::Base" and has any
37 methods that it provides.
38
40 init()
41 "init()" is called by the constructor, and sets up the list of
42 threading models that "Pipeline::Segment::Async" is aware of. See
43 "threading_models()" for more information.
44
45 threading_models( [ARRAYREF] )
46 "threading_models()" gets and sets a list of classes that know how
47 to process segements asynchronously.
48
49 predispatch()
50 "predispatch()" is called by the pipeline dispatcher and prepares
51 the segment for asynchronous execution.
52
53 model( [Pipeline::Segment::Async::*] )
54 "model()" returns an object that represents the threading model
55 that "Pipeline::Segment::Async" will call. If it does not yet have
56 an object a call to "determine_threading_model()" is called.
57
58 determine_threading_model()
59 "determine_threading_model()" will look at all the classes in the
60 list provided by "threading_models()" and determine if they can
61 operate under the current configuration. It will return an object
62 of one of those classes, provided it can operate.
63
64 reattach()
65 "reattach()" takes a detached asynchronous segment and joins it
66 back, placing the results in the correct area of the pipeline.
67
68 discard()
69 "discard()" flags an asynchronous segment as never needing to be
70 reattached.
71
72 dispatch_method()
73 "dispatch_method()" tells the pipeline dispatch class which method
74 to call in order to dispatch this class. In the case of
75 "Pipeline::Segment::Async" it returns a constant with the value
76 predispatch.
77
79 Pipeline::Segment, Pipeline::Dispatch, Pipeline::Base,
80 Pipeline::Segment::Async::Handler
81
83 James A. Duncan <jduncan@fotango.com>
84
86 Copyright 2003 Fotango Ltd. All Rights Reserved.
87
88 This software is released under the same terms as Perl itself.
89
90
91
92perl v5.32.0 2020-07-28 Pipeline::Segment::Async(3)