process_view: make sure happens once at a time...

I think this can potentially run twice on a rare occasion when
first populating and/or sorting maybe... it shouldn't hurt
This commit is contained in:
Alastair Poole 2020-09-12 13:40:40 +01:00
parent df89bb22cc
commit 059290f075
1 changed files with 10 additions and 0 deletions

View File

@ -2,6 +2,8 @@
#include "../system/process.h"
#include "util.c"
static Eina_Lock _lock;
typedef struct {
int tid;
char *name;
@ -284,6 +286,8 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
Elm_Object_Item *it;
Eina_List *l, *threads = NULL;
eina_lock_take(&_lock);
if (!ui->hash_cpu_times)
ui->hash_cpu_times = eina_hash_string_superfast_new(_hash_free_cb);
@ -329,6 +333,7 @@ _thread_info_set(Ui_Process *ui, Proc_Info *proc)
elm_genlist_item_update(it);
it = elm_genlist_item_next_get(it);
}
eina_lock_release(&_lock);
}
static void
@ -1043,6 +1048,7 @@ _win_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
ui = data;
win = obj;
if (ui->hash_cpu_times)
eina_hash_free(ui->hash_cpu_times);
if (ui->timer_pid)
@ -1052,6 +1058,8 @@ _win_del_cb(void *data, Evas_Object *obj EINA_UNUSED,
if (ui->cache)
evisum_ui_item_cache_free(ui->cache);
eina_lock_free(&_lock);
evas_object_del(win);
free(ui);
@ -1123,6 +1131,8 @@ ui_process_win_add(Evas_Object *parent_win, int pid, const char *cmd, int poll_d
ui->cache = evisum_ui_item_cache_new(ui->genlist_threads, _item_create, 10);
eina_lock_new(&_lock);
_proc_info_update(ui);
}