Determine if only one instance is running: Difference between revisions

Content added Content deleted
m (→‎{{header|Sidef}}: replaced "File::" with "File.")
Line 832: Line 832:


# Now call the flock() method on it
# Now call the flock() method on it
fh.flock(File::LOCK_EX | File::LOCK_NB)
fh.flock(File.LOCK_EX | File.LOCK_NB)
|| die "I'm already running!";
|| die "I'm already running!";


Line 839: Line 839:
Sys.sleep(20);
Sys.sleep(20);
say 'Done!';</lang>
say 'Done!';</lang>

=={{header|Swift}}==
=={{header|Swift}}==
Uses NSDistributedNotificationCenter. Works with Swift 1.2.
Uses NSDistributedNotificationCenter. Works with Swift 1.2.