IPC and counters
Philip Newton
philip.newton at gmail.com
Thu Oct 16 07:36:34 BST 2008
On Wed, Oct 15, 2008 at 02:01, Simon Wistow <simon at thegestalt.org> wrote:
> Child:
>
> my ($msg, $sem_id) = get_message();
> my $sem = IPC::Semaphore->new($sem_id);
> if (0 == $sem->op(0, -1, IPC_NOWAIT)) {
> do_something($message);
> }
>
> # If we're the last then clean up
> if (EAGAIN == $sem->op(1,-1, IPC_NOWAIT)) {
> $sem->remove;
> }
Does the module really export no constants for this "0, 1, -1" stuff?
It all seems rather error-prone to me.
Cheers,
--
Philip Newton <philip.newton at gmail.com>
More information about the london.pm
mailing list