Re: Thread usage cases

2000-08-19 Thread Chaim Frenkel
> "BCW" == Bryan C Warnock <[EMAIL PROTECTED]> writes: >> 3. Subroutines >> >> sub foo { print "foo" } >> >> Thread1 Thread2 >> foo(); eval 'sub foo { print "bar" }'; >> >> This prints either "foo" or "bar". >> >> Thread2 replaces the coderef for &main::foo. Th

Re: Thread usage cases

2000-08-19 Thread Bryan C . Warnock
On Fri, 18 Aug 2000, Steven W McDougall wrote: > Thread1 Thread2 > push @a, (1, 2, 3); push @a, (4, 5, 6); > > The interesting question is whether push is atomic. Array operations should be atomic. > > Atomic > @a is either (1, 2, 3, 4, 5, 6) or (4, 5, 6, 1, 2,

Re: Thread usage cases

2000-08-18 Thread Christopher J. Madsen
Steven W McDougall writes: > 4. Regular expressions > It seems like an RE match should be atomic, because it hard to imagine > it executing sensibly if the target string changes during the match. > But then we have > > Thread1 Thread2 > $a =~ s/.../.../e; $a

Thread usage cases

2000-08-18 Thread Steven W McDougall
1. Scalars Thread1 Thread2 $a = 1; $a = 2; $a is set to 1 and then 2, or 2 and then 1. It just depends which thread gets there first. 2. Arrays Thread1 Thread2 push @a, (1, 2, 3); push @a, (4, 5, 6); The interesting question