On Tue, Oct 15, 2002 at 10:34:26AM +0100, Nicholas Clark wrote:
> On Mon, Oct 14, 2002 at 09:00:42PM -0400, Michael G Schwern wrote:
> > 5.8.0's threads are giving me serious headaches.  When 5.8.1 comes out I
> > might drop support for 5.8.0's threads just so I can remove a large volume
> > of work-around code.
> 
> Leaving support for 5.005 threads in? I'm confused.

Test::Builder has never supported 5.005 threads.  At least, I haven't done
anything special to make it work.


> Or do you mean dropping all automatic threading support?

What I mean is in order to make Test::Builder work with 5.8.0's ithreads I
had to hack around a whole lot of bugs and write some really awful code.
Most of it having to do with automatic array/hash extensions not being
shared.  For example:

        # 5.8.0 threads bug.  Shared arrays will not be auto-extended 
        # by a slice.  Worse, we have to fill in every entry else
        # we'll get an "Invalid value for shared scalar" error
        for my $idx ($#Test_Results..$Expected_Tests-1) {
            my %empty_result = ();
            share(%empty_result);
            $Test_Results[$idx] = \%empty_result
              unless defined $Test_Results[$idx];
        }

That whole block is just a work around for a 5.8.0 ithreads bug.  There's
more like it to make Test::Builder work transparently with ithreads.  Here's
another:

    my %result;
    share(%result);
    %result = (
        'ok'      => 1,
        actual_ok => 1,
        name      => '',
        type      => 'skip',
        reason    => $why,
    );
    $Test_Results[$Curr_Test-1] = \%result;

which was originally written:

    $Test_Results[$Curr_Test-1] = {
        'ok'      => 1,
        actual_ok => 1,
        name      => '',
        type      => 'skip',
        reason    => $why,
    };

and could not be written:

    $Test_Results[$Curr_Test-1] = &share {
        'ok'      => 1,
        actual_ok => 1,
        name      => '',
        type      => 'skip',
        reason    => $why,
    };

because threads::shared::share() is broken when threads are disabled.

Really irritating stuff.  Every release since 0.45 has added more ithread
work arounds.

So when 5.8.1 comes out and ithreads work better I plan on dropping support
for 5.8.0's still broken ithreads like a hot potato so I can remove all that
hackery.  5.8.1's less buggy ithreads will be supported, hopefully with a
minimum of hackery.  Users will simply have to upgrade, which they really
should do anyway if they're using threads.


-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl Quality Assurance      <[EMAIL PROTECTED]>         Kwalitee Is Job One
I'm spanking my yacht.

Reply via email to