1Test2::Manual::Anatomy:U:sIePrC(C3o)ntributed Perl DocumTeenstta2t:i:oMnanual::Anatomy::IPC(3)
2
3
4
6 Test2::Manual::Anatomy::IPC - Manual for the IPC system.
7
9 This document describes the IPC system.
10
12 The IPC system is activated by loading Test2::IPC. This makes hubs
13 process/thread aware, and makes them forward events along to the parent
14 process/thread as necessary.
15
17 Test2::API and Test2::API::Instance have some behaviors that trigger if
18 Test2::IPC is loaded before the global state is initialized. Mainly an
19 IPC driver will be initiated and stored in the global state.
20
21 If an IPC driver is initialized then all hubs will be initialized with
22 a reference to the driver instance. If a hub has an IPC driver instance
23 it will use it to forward events to parent processes and threads.
24
26 An Test2::IPC::Driver provides a way to send event data to a
27 destination process+thread+hub (or to all globally). The driver must
28 also provide a way for a process/thread/hub to read in any pending
29 events that have been sent to it.
30
32 The default IPC driver is Test2::API::Driver::Files. This default
33 driver, when initialized, starts by creating a temporary directory. Any
34 time an event needs to be sent to another process/thread/hub, the event
35 will be written to a file using Storable. The file is written with the
36 destination process, thread, and hub as part of the filename. All hubs
37 will regularly check for pending IPC events and will process them.
38
39 This driver is further optimized using a small chunk of SHM. Any time a
40 new event is sent via IPC the shm is updated to have a new value. Hubs
41 will not bother checking for new IPC events unless the shm value has
42 changed since their last poll. A result of this is that the IPC system
43 is surprisingly fast, and does not waste time polling the hard drive
44 when there are no pending events.
45
47 Test2::Manual - Primary index of the manual.
48
50 The source code repository for Test2-Manual can be found at
51 https://github.com/Test-More/Test2-Suite/.
52
54 Chad Granum <exodist@cpan.org>
55
57 Chad Granum <exodist@cpan.org>
58
60 Copyright 2018 Chad Granum <exodist@cpan.org>.
61
62 This program is free software; you can redistribute it and/or modify it
63 under the same terms as Perl itself.
64
65 See http://dev.perl.org/licenses/
66
67
68
69perl v5.32.0 2020-12-16 Test2::Manual::Anatomy::IPC(3)