Ah, you mean to hold the lock for all the child opcodes as well. In that case, the Anonymous Monk already answered
Sometimes the scope of the CS is too big.
$shared .= <PIPE>;
would need to be written as
my $local = <PIPE>; $shared .= $local;
Sometimes the scope is too small.
# XXX. The key and value are related. my $string = $shared_key . ' => ' . $shared_value;
won't work without explicit locking.
As you can see, the user still needs to be fully aware of the locking mechanism and must sometimes compensate for it. The only thing accomplished is the removal of the visual cues that something special is happening.
And that's assuming you can figure out where to end the critical section. Consider the following:
In reply to Re^3: A faster?, safer, user transparent, shared variable "locking" mechanism.
by ikegami
in thread A faster?, safer, user transparent, shared variable "locking" mechanism.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |