in reply to Re: Testing methodology
in thread Testing methodology

Why would you not use Thread::Conveyor?

Because I know better. Why are you suggesting it when you obviously do not?

I was asked to update this to explain my reasoning, so here it is:

Thread::Conveyor doesn't work. It isn't thread-safe.

Don't believe me, try it for yourself! I'll even provide the test script for you:

#! perl -slw use strict; use threads ( stack_size => 4096 ); use Thread::Conveyor; my $belt = Thread::Conveyor->new( { maxboxes => 50, minboxes => 25, optimize => 'memory', # or 'cpu' }); async{ print while defined( $_ = $belt->take ); }->detach; $belt->put( $_ ) for 1 .. 10; $belt->put( undef );

Nine times out of ten this will segfault with;

Problem signature: Problem Event Name: APPCRASH Application Name: perl.exe Application Version: Application Timestamp: 4b60ba96 Fault Module Name: perl510.dll Fault Module Version: Fault Module Timestamp: 4b60ba95 Exception Code: c0000005 Exception Offset: 000000000006c6f8 OS Version: 6.0.6001. Locale ID: 2057 Additional Information 1: 90e0 Additional Information 2: e939a93db866b76af40148e39e07fd0d Additional Information 3: 85c4 Additional Information 4: 6c632c487ffa8e4b9b7137dbbbe72313

On the 10th occasion it will emit the following before hanging:

C:\test>t-TCcrap 1 2 3 4 5 6 7 8 Thread 1 terminated abnormally: Can't use an undefined value as an ARR +AY reference at C:/Perl64/site/lib/Thread/Tie/ (loaded on dem +and from offset 1939 for 176 bytes) line 75. Terminating on signal SIGINT(2)

And if you trace the run you get: