#!/n/gnu/bin/perl -w

use IPC::SysV qw(IPC_CREAT);

$IPC_KEY = 1234;

$key = semget($IPC_KEY,  0 , 0 );
die if !defined($key);
print "got key $key\n";

# 'give' the semaphore
# run this in the original process and you will see
# that the second process continues

$key = semget($IPC_KEY, 0, 0);
die if !defined($key);

$semnum = 0;
$semflag = 0;

# Decrement the semaphore count
$semop = -1;
$opstring = pack("sss", $semnum, $semop, $semflag);

semop($key,$opstring) || die "$!";
