thread-mainloop: add more logs for thread termination and thread join 75/196175/2 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20190114.060105 submit/tizen_5.0/20190109.095737 submit/tizen_5.0/20190111.020025
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 24 Dec 2018 11:08:44 +0000 (20:08 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Wed, 26 Dec 2018 03:47:35 +0000 (12:47 +0900)
Sometimes thread is still running after stop function is called,
which causes crash when dispatching event after that.
We have no idea whether thread join is done completely or not because of log absent,
added logs will be used for further debugging when it is reproduced.

[Version] 11.1-55
[Issue Type] Debugging

Change-Id: I490ae650a675d3302f472a068814954b69e8ac6c

packaging/pulseaudio.spec
src/pulse/thread-mainloop.c

index ee7d94d..e3949e0 100644 (file)
@@ -3,7 +3,7 @@
 Name:             pulseaudio
 Summary:          Improved Linux sound server
 Version:          11.1
-Release:          54
+Release:          55
 Group:            Multimedia/Audio
 License:          LGPL-2.1
 URL:              http://pulseaudio.org
index 993b7ba..7fb4143 100644 (file)
@@ -100,6 +100,10 @@ static void thread(void *userdata) {
     (void) pa_mainloop_run(m->real_mainloop, NULL);
 
     pa_mutex_unlock(m->mutex);
+
+#ifdef __TIZEN__
+    pa_log_info("thread exit : m=%p, thread=%p, name=%s", m, m->thread, m->name);
+#endif
 }
 
 pa_threaded_mainloop *pa_threaded_mainloop_new(void) {
@@ -156,6 +160,9 @@ int pa_threaded_mainloop_start(pa_threaded_mainloop *m) {
 }
 
 void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) {
+#ifdef __TIZEN__
+    int ret = 0;
+#endif
     pa_assert(m);
 
     if (!m->thread || !pa_thread_is_running(m->thread))
@@ -168,7 +175,14 @@ void pa_threaded_mainloop_stop(pa_threaded_mainloop *m) {
     pa_mainloop_quit(m->real_mainloop, 0);
     pa_mutex_unlock(m->mutex);
 
+#ifdef __TIZEN__
+    ret = pa_thread_join(m->thread);
+    if (ret != 0)
+        pa_log_error("pa_thread_join failed : m=%p, thread=%p, errno=%d", m, m->thread, ret);
+#else
     pa_thread_join(m->thread);
+#endif
+
 }
 
 void pa_threaded_mainloop_lock(pa_threaded_mainloop *m) {