summaryrefslogtreecommitdiffhomepage
path: root/subr/rtl_complex.subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-19 11:44:23 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-19 11:44:23 +0000
commit847bee79d77df86299bb5ac909b15b22ad221bd7 (patch)
tree2aeb63f9f6855b1b2291e35ffa11ed46ba060b1e /subr/rtl_complex.subr
parente1d4697bc4af580c8bbdb8256fdc90626e18a226 (diff)
downloadmidipix_build-847bee79d77df86299bb5ac909b15b22ad221bd7.tar.bz2
midipix_build-847bee79d77df86299bb5ac909b15b22ad221bd7.tar.xz
subr/{pkg_install,rtl_fetch}.subr, subr/rtl_complex.subr:rtl_flock_acquire(): split.
Diffstat (limited to 'subr/rtl_complex.subr')
-rw-r--r--subr/rtl_complex.subr13
1 files changed, 13 insertions, 0 deletions
diff --git a/subr/rtl_complex.subr b/subr/rtl_complex.subr
index 2ce5dd16..8aa59bec 100644
--- a/subr/rtl_complex.subr
+++ b/subr/rtl_complex.subr
@@ -95,6 +95,19 @@ rtl_filter_vars() {
printf "%s" "${_vars}";
};
+rtl_flock_acquire() {
+ local _fd="${1}" _conflict_exit_code="${2:-622}" _wait="${3:-3600}"
+ while true; do
+ if flock -E "${_conflict_exit_code}" -w "${_wait}" "${_fd}"; then
+ break;
+ elif [ "${?}" -eq "${_conflict_exit_code}" ]; then
+ continue;
+ else
+ return "${?}";
+ fi;
+ done;
+};
+
rtl_get_cpu_count() {
local _line="" _ncpus=0 _rc=0 _sname="$(uname -s 2>/dev/null)"; _status="";
case "${_sname}" in