>>>>> "SWM" == Steven W McDougall <[EMAIL PROTECTED]> writes:

>> Single thingee access mediation, should be done automatically by perl.
>> The multi-thingee complex mediation should have the user step in, since
>> solving it (correctly and efficiently) is a complex problem.

SWM> I'm not sure we have a common understanding of the terms we are using.
SWM> Can you give some examples showing what happens

SWM> - with    single thingee access mediation

        my $a :shared;

        Perl handles the mutex.

SWM> - without single thingee access mediation

        my $a;

        Perl simply ignores locking. Thread gets the value of the winner
        in a race condition. Perl does _not_ crash and burn. Internal
        structures, mallocs, and accesses are properly mutexed.

SWM> - with     multi-thingee complex mediation 

        my $pumpkin;
        my @foo :shared_nolock;                 # Just made this up.
        my $foo_counter :shared_nolock;         # Its spelled wrong

        sub foo {
                lock($pumpkin);         # I'm a critical section
                push(@foo, $bar);       
                $foo_counter++ unless $bar % 7
        }

SWM> - without  multi-thingee complex mediation 

        my @foo :shared;
        my $foo_counter :shared;


        push(@foo, $bar);
        $foo_counter++ unless $bar % 7
        
        There is nothing to keep $foo_counter and @foo in sync. Two
        different unrelated items, that are each individually properly
        syncronized by perl, but the whole is wrong.

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to