5 our $VERSION = '1.302071';
8 use Test2::API::Instance;
9 use Test2::Util qw/get_tid/;
13 test2_ipc_enable_polling
22 our @EXPORT_OK = qw/cull/;
23 BEGIN { require Exporter; our @ISA = qw(Exporter) }
26 goto &Exporter::import unless test2_init_done();
28 confess "Cannot add IPC in a child process (" . test2_pid() . " vs $$)" if test2_pid() != $$;
29 confess "Cannot add IPC in a child thread (" . test2_tid() . " vs " . get_tid() . ")" if test2_tid() != get_tid();
31 Test2::API::_set_ipc(_make_ipc());
32 apply_ipc(test2_stack());
34 goto &Exporter::import;
39 my ($driver) = Test2::API::test2_ipc_drivers();
41 require Test2::IPC::Driver::Files;
42 $driver = 'Test2::IPC::Driver::Files';
45 return $driver->new();
55 confess "Cannot add IPC in a child process" if $root->pid != $$;
56 confess "Cannot add IPC in a child thread" if $root->tid != get_tid();
58 my $ipc = $root->ipc || test2_ipc() || _make_ipc();
60 # Add the IPC to all hubs
61 for my $hub (@$stack) {
63 confess "IPC Mismatch!" if $has && $has != $ipc;
66 $ipc->add_hub($hub->hid);
69 test2_ipc_enable_polling();
90 Test2::IPC - Turn on IPC for threading or forking support.
94 You should C<use Test2::IPC;> as early as possible in your test file. If you
95 import this module after API initialization it will attempt to retrofit IPC
96 onto the existing hubs.
100 All exports are optional.
106 Cull allows you to collect results from other processes or threads on demand.
112 The source code repository for Test2 can be found at
113 F<http://github.com/Test-More/test-more/>.
119 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
127 =item Chad Granum E<lt>exodist@cpan.orgE<gt>
133 Copyright 2016 Chad Granum E<lt>exodist@cpan.orgE<gt>.
135 This program is free software; you can redistribute it and/or
136 modify it under the same terms as Perl itself.
138 See F<http://dev.perl.org/licenses/>