Then you are back to locking everything in sight.

Consider the simple solution.

my $group_a : shared;

my $group_b : shared;

        sub foo { lock $group_a; .... }
        sub fo1 { lock $group_a; .... }
        sub fo2 { lock $group_a; .... }

        sub bar { lock $group_b; .... }
        sub ba1 { lock $group_b; .... }
        sub ba2 { lock $group_b; .... }

The user has reduced the problem to a _single_ mutex call. And he
can do whatever he needs at this point.

Alternatively, we could supply monitor subroutines, which would do
the same.

But the grouping of related locks can most easily be done by the user
and probably a lot more efficiently then the pessimistic locking perl
would need to perform.

<chaim>

>>>>> "DLN" == David L Nicol <[EMAIL PROTECTED]> writes:

DLN> Chaim Frenkel wrote:
>> 
>> >>>>> "DLN" == David L Nicol <[EMAIL PROTECTED]> writes:
>> 
DLN> What if every subroutine tagged itself with a list of the globals
DLN> it uses, so a calling routine would know to add those to the list
DLN> of globals it wants locked?
>> 
>> And what about all the subroutines _it_ will call? 

DLN> Yes, exactly.  So the "top level block" would have all the globals
DLN> in the whole program referenced by itself.

DLN> This tagging could be one of the tools we give programmers to help
DLN> make managing locking a little bit easier.

DLN> It might not work.



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

Reply via email to