mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
squash: multithreaded progress lock
This commit is contained in:
parent
0ebc6fef63
commit
750772193d
@ -69,10 +69,10 @@ package_worker() {
|
|||||||
(
|
(
|
||||||
flock --exclusive 95
|
flock --exclusive 95
|
||||||
num=$(($(cat "${THREAD_CONTROL}/progress") + 1))
|
num=$(($(cat "${THREAD_CONTROL}/progress") + 1))
|
||||||
cp "${THREAD_CONTROL}/progress" "${THREAD_CONTROL}/progress.prev"
|
mv "${THREAD_CONTROL}/progress" "${THREAD_CONTROL}/progress.prev"
|
||||||
echo "${num}" >"${THREAD_CONTROL}/progress"
|
echo ${num} >"${THREAD_CONTROL}/progress"
|
||||||
printf "[%0*d/%0*d] [%-4s] %-7s %s\n" ${#jobs} ${num} ${#jobs} ${jobs} "${status}" "${task}" "${pkgname}" >&2
|
printf "[%0*d/%0*d] [%-4s] %-7s %s\n" ${#jobs} ${num} ${#jobs} ${jobs} "${status}" "${task}" "${pkgname}" >&2
|
||||||
) 95<"${THREAD_CONTROL}/progress"
|
) 95>"${THREAD_CONTROL}/progress.lock"
|
||||||
|
|
||||||
if [ ${result} -eq 0 ]; then
|
if [ ${result} -eq 0 ]; then
|
||||||
pkg_lock_status "IDLE"
|
pkg_lock_status "IDLE"
|
||||||
@ -97,9 +97,7 @@ EOF
|
|||||||
export -f package_worker
|
export -f package_worker
|
||||||
|
|
||||||
start_multithread_build() {
|
start_multithread_build() {
|
||||||
local logbuffer withlocks now
|
local logbuffer withlocks
|
||||||
|
|
||||||
now=$(date +%s)
|
|
||||||
|
|
||||||
# init thread control folder
|
# init thread control folder
|
||||||
rm -fr "${THREAD_CONTROL}"
|
rm -fr "${THREAD_CONTROL}"
|
||||||
@ -132,7 +130,7 @@ start_multithread_build() {
|
|||||||
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || return
|
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || return
|
||||||
|
|
||||||
cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
|
cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
|
||||||
MTBUILDSTART=${now} MTWITHLOCKS=${withlocks} ${TOOLCHAIN}/bin/parallel \
|
MTBUILDSTART=$(date +%s) MTWITHLOCKS=${withlocks} ${TOOLCHAIN}/bin/parallel \
|
||||||
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" ${logbuffer} --halt now,fail=1 --plus \
|
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" ${logbuffer} --halt now,fail=1 --plus \
|
||||||
package_worker {%} {#} {##} {} || return
|
package_worker {%} {#} {##} {} || return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user