Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Previous Instances

by beretboy (Chaplain)
on Mar 04, 2003 at 00:00 UTC ( #240198=perlquestion: print w/replies, xml ) Need Help??
beretboy has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know of a way to detect if there are any previous instances of a perl program running, on Windows?

"Sanity is the playground of the unimaginative" -Unknown

Replies are listed 'Best First'.
Re: Previous Instances
by caedes (Pilgrim) on Mar 04, 2003 at 00:03 UTC
Re: Previous Instances
by Cabrion (Friar) on Mar 04, 2003 at 04:24 UTC
    If you don't care about portability, Windows programs typically use semaphores to detect that. There is a perl module that provides access to semaphores. This won't work on other platforms. It looks like the newer Perl's provide semaphores in a multi-threaded build, but I don't know how pervasive they are.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://240198]
[ambrus]: Corion: pre-fork before creating any threads
[ambrus]: it's good practice anyway, even if Linux tolerates forking after creating threads (tolerates, as in, the fork works, but other threads are dead which can lead to interesting deadlocks)
[marto]: could be worse, could be dust
[ambrus]: Corion: if you're forking from perl, then schmorp has a module that helps this prefork magic

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2017-10-19 14:48 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (253 votes). Check out past polls.