summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>2018-05-15 17:04:19 +0300
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>2018-05-16 15:35:23 +0300
commit51c9b05d50e98fa9d28df0f229b4ac590a98c25a (patch)
tree4b49b007a4f8ff4e6fed59b53342c4f89905d6aa
parentd4c49eb90832f35092896ece7281510cadc5f5b5 (diff)
downloadswap-manager-51c9b05d50e98fa9d28df0f229b4ac590a98c25a.tar.gz
swap-manager-51c9b05d50e98fa9d28df0f229b4ac590a98c25a.tar.bz2
swap-manager-51c9b05d50e98fa9d28df0f229b4ac590a98c25a.zip
Add locked sections for obj_list
Change-Id: Id7b3d7b6003e58d9a448be5ae7e7df58d6835f30 Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
-rw-r--r--ui_viewer/ui_viewer_data.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ui_viewer/ui_viewer_data.c b/ui_viewer/ui_viewer_data.c
index 243a699..2dda6c1 100644
--- a/ui_viewer/ui_viewer_data.c
+++ b/ui_viewer/ui_viewer_data.c
@@ -415,23 +415,32 @@ void pack_ui_obj_info_list(int file, enum rendering_option_t rendering,
print_log_ui_viewer_hierarchy_error();
}
+ pthread_mutex_lock(&request_lock);
EINA_LIST_FREE(obj_list, obj)
{
- pthread_mutex_lock(&request_lock);
+ pthread_mutex_unlock(&request_lock);
+
// check if hierarchy request is active
if (get_hierarchy_status() == HIERARCHY_RUNNING) {
+ pthread_mutex_lock(&request_lock);
_pack_ui_obj_info(file, obj, rendering);
+ pthread_mutex_unlock(&request_lock);
} else {
ui_viewer_log("break packing hierarchy info\n");
// don't save any data if request was cancelled
*cancelled = EINA_TRUE;
- pthread_mutex_unlock(&request_lock);
+
+ /*
+ * 'request_lock' is locked to preserve
+ * the state consistency at loop exit.
+ */
+ pthread_mutex_lock(&request_lock);
break;
}
- pthread_mutex_unlock(&request_lock);
- }
- pthread_mutex_lock(&request_lock);
+ pthread_mutex_lock(&request_lock);
+ }
+ // 'request_lock' is not unlocked because it must be locked.
// unref remained objects
EINA_LIST_FREE(obj_list, obj)