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

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

Thread Previous | Thread Next
Rafael Garcia-Suarez
November 30, 2003 13:03
Re: [PATCH] cond_wait() and arbitrary lock variables
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About