Delete g_cond_wait from tpl_gsource_destroy. 01/282301/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Wed, 28 Sep 2022 11:26:57 +0000 (20:26 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Wed, 28 Sep 2022 11:27:21 +0000 (20:27 +0900)
commit0724b49458ea5b17330fae3f3aeff67401641c81
tree836fa6fb5d46ff5efd644d47fb9622f14ded38e0
parent7043c50993c996ba17df4f3cf21436c9d37a9a79
Delete g_cond_wait from tpl_gsource_destroy.

 - g_cond_wait does not guarantee perfectly.
  Therefore, it is recommended that the caller of tpl_gsource_destroy
  should call the g_cond_wait to confirm if the destroy is
  actually complete.

 - https://docs.gtk.org/glib/method.Cond.wait.html
  Atomically releases mutex and waits until cond is signalled.
 When this function returns, mutex is locked again
 and owned by the calling thread.

  When using condition variables, it is possible that a spurious
 wakeup may occur (ie: g_cond_wait() returns even though g_cond_signal()
 was not called). It’s also possible that a stolen wakeup may occur.
 This is when g_cond_signal() is called, but another thread acquires
 mutex before this thread and modifies the state of the program in such
 a way that when g_cond_wait() is able to return,
 the expected condition is no longer met.

 For this reason, g_cond_wait() must always be used in a loop.
 See the documentation for GCond for a complete example.

Change-Id: If3b98b4d79b205d9125558edb75f4b85ef6a3a99
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_utils_gthread.c
src/tpl_utils_gthread.h