Multithreaded print safe perl model
Unfortunately Perl’s print function isn’t thread safe, so concurrent calls to it from multiple threads can lead to output that is mangled etc. I use the following framework that I wrote for a small project for all of my filter applications that require some kind of sane output. #!/usr/bin/perl use threads; use Thread::Queue; [...]