From 77ea72fb991837a9d85cec6ff8451067b32a6aad Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 25 Apr 2019 21:03:39 -0400 Subject: src/mutex.sh: Shift function arguments --- (limited to 'src') diff --git a/src/mutex.sh b/src/mutex.sh index dc23070..ec51a2b 100644 --- a/src/mutex.sh +++ b/src/mutex.sh @@ -21,6 +21,7 @@ _mutex_trylock() { local mutex="${1}" + shift 1 (set -C; printf '%d\n' "${$}" >"${mutex}") 2>/dev/null || return ${?} return 0 @@ -30,6 +31,7 @@ mutex_timedlock() { local mutex="${1}" local timeout="${2}" + shift 2 while ! _mutex_trylock "${mutex}"; do [ ${timeout} -eq 0 ] && return 1 @@ -43,6 +45,7 @@ mutex_timedlock() mutex_unlock() { local mutex="${1}" + shift 1 rm -f -- "${mutex}" } @@ -50,6 +53,7 @@ mutex_unlock() mutex_is_unlockable() { local mutex="${1}" + shift 1 [ "x$(cat -- "${mutex}" 2>/dev/null)" = "x${$}" ] || return ${?} return 0 -- cgit v0.9.1