Fix thread suspend logic for pkgmgr_thread 10/300410/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Tue, 24 Oct 2023 06:33:44 +0000 (15:33 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Tue, 24 Oct 2023 06:33:44 +0000 (15:33 +0900)
commit0dcca2c2c85526ea27376f72d703a726a83aa5dd
tree44734e7ec9478660fdb226820e84cdfb011cd174
parentcb4fdc6e80db1bbb5cd355d0f2348f3704e0f4df
Fix thread suspend logic for pkgmgr_thread

- Issue:
If pkgmgr_client_new() is continously failed, pkgmgr_thread can sleep
very long time and this can cause deadlock when the app tries to destroy
the handle.

- Solution:
To reduce the error log, gradually increased suspend time logic was
added in pkgmgr thread. However, the suspend time could increase
without limitation and this long suspend time might cause critical
deadlock.
To solve this problem, this patch changes the suspend logic with
conditional variable. Using conditional variable, the framework will be
able to resume the thread and properly terminate it even if the suspend
time is too long. And also this patch adds a limitation for the suspend
time. So, even if the thread termination logic is failed, the thread
will be exited in a reasonable time.

Change-Id: I6e126464032a70dbf1d5f63a03c7a85c01ef0a8d
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts_core.c