aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/ui/browser.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/ui/browser.c')
-rw-r--r--tools/perf/util/ui/browser.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c
index 8bc010edca25..60d6c815e1db 100644
--- a/tools/perf/util/ui/browser.c
+++ b/tools/perf/util/ui/browser.c
@@ -1,4 +1,5 @@
1#include "libslang.h" 1#include "libslang.h"
2#include "ui.h"
2#include <linux/compiler.h> 3#include <linux/compiler.h>
3#include <linux/list.h> 4#include <linux/list.h>
4#include <linux/rbtree.h> 5#include <linux/rbtree.h>
@@ -178,6 +179,7 @@ int ui_browser__show(struct ui_browser *self, const char *title,
178 if (self->sb == NULL) 179 if (self->sb == NULL)
179 return -1; 180 return -1;
180 181
182 pthread_mutex_lock(&ui__lock);
181 SLsmg_gotorc(0, 0); 183 SLsmg_gotorc(0, 0);
182 ui_browser__set_color(self, NEWT_COLORSET_ROOT); 184 ui_browser__set_color(self, NEWT_COLORSET_ROOT);
183 slsmg_write_nstring(title, self->width); 185 slsmg_write_nstring(title, self->width);
@@ -188,25 +190,30 @@ int ui_browser__show(struct ui_browser *self, const char *title,
188 va_start(ap, helpline); 190 va_start(ap, helpline);
189 ui_helpline__vpush(helpline, ap); 191 ui_helpline__vpush(helpline, ap);
190 va_end(ap); 192 va_end(ap);
193 pthread_mutex_unlock(&ui__lock);
191 return 0; 194 return 0;
192} 195}
193 196
194void ui_browser__hide(struct ui_browser *self) 197void ui_browser__hide(struct ui_browser *self)
195{ 198{
199 pthread_mutex_lock(&ui__lock);
196 newtFormDestroy(self->form); 200 newtFormDestroy(self->form);
197 self->form = NULL; 201 self->form = NULL;
198 ui_helpline__pop(); 202 ui_helpline__pop();
203 pthread_mutex_unlock(&ui__lock);
199} 204}
200 205
201int ui_browser__refresh(struct ui_browser *self) 206int ui_browser__refresh(struct ui_browser *self)
202{ 207{
203 int row; 208 int row;
204 209
210 pthread_mutex_lock(&ui__lock);
205 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1); 211 newtScrollbarSet(self->sb, self->index, self->nr_entries - 1);
206 row = self->refresh(self); 212 row = self->refresh(self);
207 ui_browser__set_color(self, HE_COLORSET_NORMAL); 213 ui_browser__set_color(self, HE_COLORSET_NORMAL);
208 SLsmg_fill_region(self->y + row, self->x, 214 SLsmg_fill_region(self->y + row, self->x,
209 self->height - row, self->width, ' '); 215 self->height - row, self->width, ' ');
216 pthread_mutex_unlock(&ui__lock);
210 217
211 return 0; 218 return 0;
212} 219}