in reply to Re: Re: Re: Re: Determining if self is already running under WinNT/2000
in thread Determining if self is already running under WinNT/2000
Win32::Mutex works ok for using the same version perl as you?
#! perl -slw use strict; use Win32::Mutex; #! backslashes are prohibited in mutex names (my $name = $0) =~ tr[\\][/]; my $mtx = Win32::Mutex->open($name); die "$0 is already running" if $mtx; $mtx = Win32::Mutex::->new(1,$name) or die $^E; print "process id: $$"; sleep 1000; __END__ c:\test>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread Binary build 633 provided by ActiveState Corp. http://www.ActiveState. +com ... c:\test>mutex process id: 200 ^C c:\test>^C c:\test>start /b mutex c:\test>process id: 218 mutex C:\test\mutex.pl is already running at C:\test\mutex.pl line 7. c:\test>kill 218 c:\test>mutex process id: 271 ^C c:\test>^C
Examine what is said, not who speaks.
The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.
|
|---|