summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-04-25 21:03:39 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-04-25 21:03:39 (EDT)
commit77ea72fb991837a9d85cec6ff8451067b32a6aad (patch)
tree24527436044912fb27eff8bcd86c475f481c2597 /src
parent284a85416ee942beef89f3ad056262e3013c41a1 (diff)
src/mutex.sh: Shift function arguments
Diffstat (limited to 'src')
-rw-r--r--src/mutex.sh4
1 files changed, 4 insertions, 0 deletions
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