CurryInfo: io-extra-3.0.0 / System.IOExts.exclusiveIO

definition:
exclusiveIO :: String -> IO a -> IO a
exclusiveIO lockfile action = do
  system $ "lockfile-create --lock-name " ++ lockfile
  catch (do actionResult <- action
            deleteLockFile
            return actionResult )
        (\e -> deleteLockFile >> ioError e)
 where
  deleteLockFile = system $ "lockfile-remove --lock-name " ++ lockfile
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
--- Forces the exclusive execution of an action via a lock file.
--- For instance, (exclusiveIO "myaction.lock" act) ensures that
--- the action "act" is not executed by two processes on the same
--- system at the same time.
--- @param lockfile - the name of a global lock file
--- @param action - the action to be exclusively executed
--- @return the result of the execution of the action
failfree:
(_, _)
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,_) |-> _}
name:
exclusiveIO
precedence:
no precedence defined
result-values:
_
signature:
String -> Prelude.IO a -> Prelude.IO a
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
reducible on all ground data terms