mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-11 20:09:26 +01:00
The ui operations so far were used by just one thread, but 'perf top --tui' now has two threads updating the screen, so we need to use a mutex to avoid garbling the screen. Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Tom Zanussi <[email protected]> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
47 lines
826 B
C
47 lines
826 B
C
#include <newt.h>
|
|
#include <signal.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "../cache.h"
|
|
#include "../debug.h"
|
|
#include "browser.h"
|
|
#include "helpline.h"
|
|
#include "ui.h"
|
|
|
|
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
static void newt_suspend(void *d __used)
|
|
{
|
|
newtSuspend();
|
|
raise(SIGTSTP);
|
|
newtResume();
|
|
}
|
|
|
|
void setup_browser(bool fallback_to_pager)
|
|
{
|
|
if (!isatty(1) || !use_browser || dump_trace) {
|
|
use_browser = 0;
|
|
if (fallback_to_pager)
|
|
setup_pager();
|
|
return;
|
|
}
|
|
|
|
use_browser = 1;
|
|
newtInit();
|
|
newtCls();
|
|
newtSetSuspendCallback(newt_suspend, NULL);
|
|
ui_helpline__init();
|
|
ui_browser__init();
|
|
}
|
|
|
|
void exit_browser(bool wait_for_ok)
|
|
{
|
|
if (use_browser > 0) {
|
|
if (wait_for_ok) {
|
|
char title[] = "Fatal Error", ok[] = "Ok";
|
|
newtWinMessage(title, ok, ui_helpline__last_msg);
|
|
}
|
|
newtFinished();
|
|
}
|
|
}
|