Skip to content

Commit 4627e3c

Browse files
authored
Merge pull request #455 from patrickelectric/fix-high-cpu-usage
scripts: create_ap: haveged_watchgod: Move mutex inside if logic
2 parents 84af02f + 78942be commit 4627e3c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/scripts/create_ap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ get_new_macaddr() {
448448
haveged_watchdog() {
449449
local show_warn=1
450450
while :; do
451-
mutex_lock
452451
if [[ $(cat /proc/sys/kernel/random/entropy_avail) -lt 1000 ]]; then
453452
if ! which haveged > /dev/null 2>&1; then
454453
if [[ $show_warn -eq 1 ]]; then
@@ -458,10 +457,11 @@ haveged_watchdog() {
458457
elif ! pidof haveged > /dev/null 2>&1; then
459458
echo "Low entropy detected, starting haveged"
460459
# boost low-entropy
460+
mutex_lock
461461
haveged -w 1024 -p $COMMON_CONFDIR/haveged.pid
462+
mutex_unlock
462463
fi
463464
fi
464-
mutex_unlock
465465
sleep 2
466466
done
467467
}

0 commit comments

Comments
 (0)