On 1/28/2019 1:53 PM, Mark Blackman wrote:

https://perldoc.perl.org/threads.html#WARNING  Threads are discouraged in Perl these days

Yes, that is indeed what the documentation says; however, there is a far cry between "Perl is single-threaded by design and history and has no reliable support for threading" and "use of threads is discouraged in perl".

Looking back to the original discussion that led to that caveat https://www.nntp.perl.org/group/perl.perl5.porters/2014/03/msg213382.html a good summary of why it is there is:

"The patch came about because unmanaged expectations of support are causing social problems"

And further discussion about it https://www.perlmonks.org/?node_id=1107534 has a similar insight:

"that this particular formulation is just smoke and mirrors to repel 'annoying newbies"

Then in this bug discussing the verbiage https://rt.perl.org/Public/Bug/Display.html?id=133021 a developer comments:

"The fact is that threads work, they are maintained, and they currently do not have any bugs preventing their use."

Basically, perl threads are heavyweight, not lightweight, and use of non-thread safe Perl code whether your own or in third-party modules will cause potentially nondeterministic problems. The warning is basically there to scare away people who don't have sufficient expertise to make it work and will likely come complain and ask for help with something the developers don't want to have to explain over and over again.

Back when I was running DCE/DFS and maintaining the perl modules on top of that, I used threaded perl heavily with no issues. As long as the mechanism of and caveats regarding Perl threads are understood, and there is a justifiable reason to be using them rather than some other construct, discouraged is not deprecated nor unavailable/unreliable.

Reply via email to