A couple of other scenerios

        Thread 1                Thread 2
        push(@a, @b);           $a[35]++

User level cross variable consistancy.

        push(@a, $b);
        $acount++ if $b <35;


Even cooperative threading doesn't help.

<chaim>

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

SWM> Others have pointed out that code inside sub-expressions and blocks
SWM> could also assign to our variables. This is true, but it isn't our
SWM> problem. As long as each assignment is carried out correctly by the
SWM> interpreter, then each variable always has a valid value, computed
SWM> from other valid values. For example,

SWM>     $a = "abcd";
SWM>     $b = "wxyz";

SWM>     Thread A    Thread B
SWM>     $a = $b;    $b = $a;

SWM> All the interpreter guarantees is
SWM> 1. It won't crash.
SWM> 2. After both threads run, $a and $b are both either "abcd" or "wxyz",
SWM>    (and not, for example, "abyz").

SWM> If the user cares whether the final values of $a and $b are "abcd" or
SWM> "wxyz", then they have to do their own synchronization.
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to