| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "Test2::Manual::Concurrency 3perl" |
| 58 |
.TH Test2::Manual::Concurrency 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Test2::Manual::Concurrency \- Documentation for Concurrency support. |
| 65 |
.SH FORKING |
| 66 |
.IX Header "FORKING" |
| 67 |
.SS Test2 |
| 68 |
.IX Subsection "Test2" |
| 69 |
Test2 supports forking. For forking to work you need to load Test2::IPC. |
| 70 |
.SS Test::Builder |
| 71 |
.IX Subsection "Test::Builder" |
| 72 |
Test::Builder Did not used to support forking, but now that it is based on |
| 73 |
Test2 it does. Test2::IPC must be loaded just as with Test2. |
| 74 |
.SS Test2::Suite |
| 75 |
.IX Subsection "Test2::Suite" |
| 76 |
Test2::Suite tools should all work fine with \fItrue\fR forking unless |
| 77 |
otherwise noted. Pseudo-fork via threads (Windows and a few others) is not |
| 78 |
supported, but may work. |
| 79 |
.PP |
| 80 |
Patches will be accepted to repair any pseudo-fork issues, but for these to be |
| 81 |
used or tested they must be requested. Fork tests should not run on pseudo-fork |
| 82 |
systems unless they are requested with an environment var, or the |
| 83 |
AUTHOR_TESTING var. Pseudo-fork is fragile, and we do not want to block install |
| 84 |
due to a pseudo-fork flaw. |
| 85 |
.SS Test::SharedFork |
| 86 |
.IX Subsection "Test::SharedFork" |
| 87 |
Test::SharedFork is currently support and maintained, though it is no longer |
| 88 |
necessary thanks to Test2::IPC. If usage ever drops off then the module may |
| 89 |
be deprecated, but for now the policy is to not let it break. Currently it |
| 90 |
simply loads Test2::IPC if it can, and falls back to the old methods on |
| 91 |
legacy installs. |
| 92 |
.SS Others |
| 93 |
.IX Subsection "Others" |
| 94 |
Individual authors are free to support or not support forking as they see fit. |
| 95 |
.SH THREADING |
| 96 |
.IX Header "THREADING" |
| 97 |
\&\fBNote\fR This only applies to ithreads. |
| 98 |
.SS Test2 |
| 99 |
.IX Subsection "Test2" |
| 100 |
The core of Test2 supports threading so long as Test2::IPC is loaded. Basic |
| 101 |
threading support (making sure events make it to the parent thread) is fully |
| 102 |
supported, and must not be broken. |
| 103 |
.PP |
| 104 |
Some times perl installs have broken threads (Some 5.10 versions compiled on |
| 105 |
newer gcc's will segv by simply starting a thread). This is beyond Test2's |
| 106 |
control, and not solvable in Test2. That said we strive for basic threading |
| 107 |
support on perl 5.8.1+. |
| 108 |
.PP |
| 109 |
If Test2 fails for threads on any perl 5.8 or above, and it is reasonably |
| 110 |
possible for Test2 to work around the issue, it should. (Patches and bug |
| 111 |
reports welcome). |
| 112 |
.SS Test::Builder |
| 113 |
.IX Subsection "Test::Builder" |
| 114 |
Test::Builder has had thread support for a long time. With Test2 the |
| 115 |
mechanism for thread support was switched to Test2::IPC. Test::Builder |
| 116 |
should still support threads as much as it did before the switch to Test2. |
| 117 |
Support includes auto-enabling thread support if threads is loaded before |
| 118 |
Test::Builder. |
| 119 |
.PP |
| 120 |
If there is a deviation between the new and old threading behavior then it is a |
| 121 |
bug (unless the old behavior itself can be classified as a bug.) Please report |
| 122 |
(or patch!) any such threading issues. |
| 123 |
.SS Test2::Suite |
| 124 |
.IX Subsection "Test2::Suite" |
| 125 |
Tools in Test2::Suite have minimal threading support. Most of these tools do |
| 126 |
not care/notice threading and simply work because Test2::IPC handles it. |
| 127 |
Feel free to report any thread related bugs in Test2::Suite. Be aware though |
| 128 |
that these tools are not legacy, and have no pre-existing thread support, we |
| 129 |
reserve the right to refuse adding thread support to them. |
| 130 |
.PP |
| 131 |
\fITest2::Workflow\fR |
| 132 |
.IX Subsection "Test2::Workflow" |
| 133 |
.PP |
| 134 |
Test2::Workflow has been merged into Test2::Suite, so it gets addressed |
| 135 |
by this policy. |
| 136 |
.PP |
| 137 |
Test2::Workflow has thread support, but you must ask for it. Thread tests |
| 138 |
for Test2::Workflow do not event run without setting either the AUTHOR_TESTING |
| 139 |
env var, or the T2_DO_THREAD_TESTS env var. |
| 140 |
.PP |
| 141 |
To use threads with Test2::Workflow you must set the T2_WORKFLOW_USE_THREADS |
| 142 |
env var. |
| 143 |
.PP |
| 144 |
If you do rely on threads with Test2::Workflow and find a bug please report it, |
| 145 |
but it will be given an ultra-low priority. Merging patches that fix threading |
| 146 |
issues will be given normal priority. |
| 147 |
.SH "SEE ALSO" |
| 148 |
.IX Header "SEE ALSO" |
| 149 |
Test2 \- Test2 itself. |
| 150 |
.PP |
| 151 |
Test2::Suite \- Initial tools built using Test2. |
| 152 |
.PP |
| 153 |
Test2::Manual \- Primary index of the manual. |
| 154 |
.SH SOURCE |
| 155 |
.IX Header "SOURCE" |
| 156 |
The source code repository for Test2\-Manual can be found at |
| 157 |
\&\fIhttps://github.com/Test\-More/Test2\-Suite/\fR. |
| 158 |
.SH MAINTAINERS |
| 159 |
.IX Header "MAINTAINERS" |
| 160 |
.IP "Chad Granum <[email protected]>" 4 |
| 161 |
.IX Item "Chad Granum <[email protected]>" |
| 162 |
.SH AUTHORS |
| 163 |
.IX Header "AUTHORS" |
| 164 |
.PD 0 |
| 165 |
.IP "Chad Granum <[email protected]>" 4 |
| 166 |
.IX Item "Chad Granum <[email protected]>" |
| 167 |
.PD |
| 168 |
.SH COPYRIGHT |
| 169 |
.IX Header "COPYRIGHT" |
| 170 |
Copyright 2018 Chad Granum <[email protected]>. |
| 171 |
.PP |
| 172 |
This program is free software; you can redistribute it and/or |
| 173 |
modify it under the same terms as Perl itself. |
| 174 |
.PP |
| 175 |
See \fIhttp://dev.perl.org/licenses/\fR |