summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-10-07 14:03:21 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-10-07 14:03:21 (EDT)
commite808e8e467554708bc54058d244a014e4a5d4b71 (patch)
tree1d2c204061e66bfcf15e62ab6ab018cbe6f54eb6 /lib
parent1c05958c9c7c4d0b7d0b30c91dddae5998ca767d (diff)
session_end(): Don't lock mutex if we have it
Diffstat (limited to 'lib')
-rw-r--r--lib/session.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/session.sh b/lib/session.sh
index 64954b5..a2d18e3 100644
--- a/lib/session.sh
+++ b/lib/session.sh
@@ -94,8 +94,11 @@ session_end()
rmdir "${session_root}/prokit/sessions/${session_id}/wd"
rmdir "${session_root}/prokit/sessions/${session_id}"
- if ! mutex_lock_timeout "${session_root}/prokit/sessions.lock" 5; then
- error 2 "$(get_msg 'cant_lock_sessions')"
+ if ! mutex_is_unlockable "${session_root}/prokit/sessions.lock"; then
+ if ! mutex_lock_timeout "${session_root}/prokit/sessions.lock" 5
+ then
+ error 2 "$(get_msg 'cant_lock_sessions')"
+ fi
fi
# Clear the sessions pool. If there are no more sessions, unmount the