develooper Front page | perl.perl5.porters | Postings from October 1999

Re: perlthread.pod -- First draft of thread docs

Thread Previous | Thread Next
Tuomas J. Lukka
October 26, 1999 01:41
Re: perlthread.pod -- First draft of thread docs
Message ID:
On Sun, 24 Oct 1999, Dan Sugalski wrote:
> Just out of curiosity, why? I presume it's unlock in addition to locks
> getting released when they fall out of scope. I can see the occasional
> need, but I don't know that it'd be used enough to justify the extra
> hassles involved.

Yes, exactly: the occasional need. When you need to acquire two locks
in a different order than you want to release them. For instance, if you
want to walk along a tree structure, first locking the root to get
the next branch, then unlocking the root so that others can walk as

Simple things simple (lock with autounlock at end of block), complicated
things possible (lock with unlock).

Actually, I think that maybe

	$lock = lock $obj;

	undef $lock;

would make a nice interface: then

		my $lock = lock $obj

would do the same as C<lock> does by default but if you want, you can
save the $lock variable somewhere.

And no, I'm not advocating removing the current functionality. Only adding
the ability to somehow get rid of locks earlier.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About