Determine if only one instance is running: Difference between revisions
Determine if only one instance is running (view source)
Revision as of 13:31, 19 August 2016
, 7 years ago→{{header|Sidef}}: modified the code to work with Sidef 2.30
m (clarified: copydata gets a copy of the command line) |
m (→{{header|Sidef}}: modified the code to work with Sidef 2.30) |
||
Line 887:
<lang ruby># For this to work, you need to explicitly
# store the returned fh inside a variable.
var fh = File
# Now call the flock() method on it
fh.flock(File.LOCK_EX | File.LOCK_NB) ->
|| die "I'm already running!"
# Your code here...
say "Running..."
Sys.sleep(20)
say 'Done!'
=={{header|Swift}}==
|