Skip Menu |

This queue is for tickets about the IPC-Semaphore-Concurrency CPAN distribution.

Report information
The Basics
Id: 79133
Status: rejected
Priority: 0/
Queue: IPC-Semaphore-Concurrency

People
Owner: DERMOTH [...] cpan.org
Requestors: NHORNE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.02
Fixed in: (no value)



Subject: add have_lock()
It would be good to have a have_lock() call for software assertions. That way code could verify asserts that the caller must have locked the resource. e.g. my write_some_bit_of_data { my $self = shift; die "failed sanity check" unless($self->have_lock()); # blah blah }
Subject: Re: [rt.cpan.org #79133] add have_lock()
Date: Sat, 18 Jan 2014 00:54:51 -0500
To: bug-IPC-Semaphore-Concurrency [...] rt.cpan.org
From: Thomas Guyot-Sionnest <dermoth [...] aei.ca>
On 22/08/12 06:45 AM, Nigel Horne via RT wrote: Show quoted text
> Wed Aug 22 06:45:04 2012: Request 79133 was acted upon. > Transaction: Ticket created by NHORNE > Queue: IPC-Semaphore-Concurrency > Subject: add have_lock() > Broken in: 0.02 > Severity: Wishlist > Owner: Nobody > Requestors: NHORNE@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=79133 > > > > It would be good to have a have_lock() call for software assertions. > That way code could verify asserts that the caller must have locked the > resource. > > e.g. > > my write_some_bit_of_data { > my $self = shift; > > die "failed sanity check" unless($self->have_lock()); > # blah blah > } >
Hi Nigel, Thanks for the suggestion. Unfortunately it's not something that is available natively with semaphores, and since they are merely shared counters it would be hard to make it meaningful when someone use it in weird ways like increasing and decreasing the semaphore multiple times, and there would be no way to track "unlocks" in forked processes... The have_lock could then become more dangerous than anything by making users thing they're safe when they aren't. Regards, -- Thomas