Set progress to 100% as soon as hash remaking is finished 56/246556/2 submit/tizen/20201104.032152
authorKichan Kwon <k_c.kwon@samsung.com>
Fri, 30 Oct 2020 04:58:12 +0000 (13:58 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Mon, 2 Nov 2020 03:09:41 +0000 (12:09 +0900)
- 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 <k_c.kwon@samsung.com>
dmverity/verity_handler.c

index e7f0db3..4fa2cb1 100755 (executable)
@@ -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);