From: Kichan Kwon Date: Fri, 30 Oct 2020 04:58:12 +0000 (+0900) Subject: Set progress to 100% as soon as hash remaking is finished X-Git-Tag: submit/tizen/20201104.032152^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42ba682d4f77c2da1659842a46b173e9c0edb120;p=platform%2Fcore%2Fsystem%2Ftota-ua.git Set progress to 100% as soon as hash remaking is finished - verity-handler always use 45 seconds though hash is not made - To prevent this situation, cancel progress thread after hash thread is terminated Change-Id: Ie31f259e0270874128a98c16ae81e1cd7f8d2b81 Signed-off-by: Kichan Kwon --- diff --git a/dmverity/verity_handler.c b/dmverity/verity_handler.c index e7f0db3..4fa2cb1 100755 --- a/dmverity/verity_handler.c +++ b/dmverity/verity_handler.c @@ -165,6 +165,7 @@ static void *__thread_draw_progress(void *arg) for (int tick = 0; tick < count; tick++) { fota_gui_update_progress((int)progress); progress += progress_increment; + pthread_testcancel(); usleep(period); } @@ -206,6 +207,10 @@ int main(int argc, char **argv) } else LOG("pthread_join(th_id_hash) succeeded \n"); + error = pthread_cancel(th_id_progress); + if (error != 0) { + LOG("progress thread is already terminated \n"); + error = pthread_join(th_id_progress, NULL); if (error != 0) { LOG("pthread_join(th_id_progress) failed (err = %d)\n", error);