Home: Perl Programming Help: Win32 Programming Help:
wierd problems with Win32::Semaphore



nagakiran
New User

Sep 21, 2009, 12:14 PM


Views: 6536
wierd problems with Win32::Semaphore


Code
use Win32::Semaphore; 
$sem = Win32::Semaphore->new(0, 1,"reliance2692") or print "Can't create semaphore\n";
$sem = Win32::Semaphore->open("reliance2692") or print "Can't open semaphore\n";
print "Semaphore:" . $sem . "\n";


By running the above program, I am getting the following output
Can't create semaphore
Can't open semaphore

The output shows that its failed to create a semaphore and even failed to open semaphore.
creating a semaphore might have failed if a semaphore already exists with the given name.
I don't understand why opening a semaphore failed.

Can some clarify the scenario where both creating semaphore & opening semaphore fails.

Are there any permissions with semaphore such that a new semaphore created can be accessed only by certain processes??

Thanks in advance,
Naga Kiran


FishMonger
Veteran / Moderator

Sep 21, 2009, 1:24 PM


Views: 6527
Re: [nagakiran] wierd problems with Win32::Semaphore

See my post on your duplicate question on EE.

http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_24749511.html