Mailing List Archive

[master] d55093f67 Move two time consuming curses operations out of the mutex
commit d55093f671b58b8a2f9dddd7a2aef15ac2895f27
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Mon Dec 11 12:37:57 2023 +0000

Move two time consuming curses operations out of the mutex

diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c
index ddec07a11..fa26a5ca8 100644
--- a/bin/varnishhist/varnishhist.c
+++ b/bin/varnishhist/varnishhist.c
@@ -151,8 +151,6 @@ update(void)
int i, j;
unsigned k, l;

- AC(erase());
-
/* Draw horizontal axis */
for (k = 0; k < n; ++k)
(void)mvaddch(LINES - 2, k, '-');
@@ -202,8 +200,6 @@ update(void)
for (; l < (bm[k] + bh[k]) / scale; ++l)
(void)mvaddch((LINES - 3) - l, k, '|');
}
-
- AC(refresh());
}

inline static void
@@ -382,9 +378,12 @@ do_curses(void *arg)
AC(curs_set(0));
AC(erase());
while (!VSIG_int && !VSIG_term && !VSIG_hup) {
+
+ AC(erase());
PTOK(pthread_mutex_lock(&mtx));
update();
PTOK(pthread_mutex_unlock(&mtx));
+ AC(refresh());

assert(ms_delay > 0);
timeout(ms_delay);
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit