commit 11304d3a60dfc469759c4662743f792cd5d4ca80
parent eb7d2b94817e8b66f62dc372a204a78a12e3ef0f
Author: Chris Down <chris@chrisdown.name>
Date: Mon, 19 Feb 2018 15:04:52 +0000
Make main work block async
Closes #59.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/clipmenud b/clipmenud
@@ -10,7 +10,7 @@ major_version=4
cache_dir=$CM_DIR/clipmenu.$major_version.$USER/
cache_file=$cache_dir/line_cache
lock_file=$cache_dir/lock
-lock_timeout=2
+lock_timeout=5
has_clipnotify=0
xsel_log=/dev/null
@@ -120,6 +120,7 @@ while true; do
fi
fi
+ {
if ! flock -x -w "$lock_timeout" "$lock_fd"; then
if (( CM_ONESHOT )); then
printf 'ERROR: %s\n' 'Timed out waiting for lock' >&2
@@ -176,8 +177,10 @@ while true; do
done
flock -u "$lock_fd"
+ } &
if (( CM_ONESHOT )); then
+ wait
debug 'Oneshot mode enabled, exiting'
break
fi