develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [PATCH] cond_wait() and arbitrary lock variables

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
November 30, 2003 13:03
Subject:
Re: [PATCH] cond_wait() and arbitrary lock variables
Message ID:
20031130220543.05d94861.rgarciasuarez@free.fr
Mike Pomraning wrote:
> The following patch against 5.8.2 allows a shared variable to be cond_wait()d
> with a distinct, shared lock variable:
> 
>    use threads::shared;
> 
>    cond_wait($v);           # $v is both condition and mutex
>    cond_wait($v, $v);       # same as above, but explicit
> 
>    cond_wait($v, $lockvar); # $v's predicate is protected by $lockvar, which
>                             # presumably protects other predicates as well
> 
> This is useful for, e.g., a Queue object which has client threads waiting on
> one of two interesting predicates:  "items ready" ($q->dequeue) or "queue
> empty" ($q->await_empty).

This looks useful indeed. However, regression tests for this new feature
would be most appreciated.
(bumping the $VERSION might be a good idea as well.)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About