]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
tvh_thread: do not use debug code when not activated, issue #5353, issue #5389
authorJaroslav Kysela <perex@perex.cz>
Mon, 3 Dec 2018 07:38:48 +0000 (08:38 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 3 Dec 2018 07:40:10 +0000 (08:40 +0100)
src/tvh_thread.c

index d4d2f1972a99aea47e18ad3371c6515fd99eedbd..6fc5c06159fd126e60595833d64eb0945585e902 100644 (file)
@@ -305,13 +305,15 @@ tvh_cond_wait
   int r;
   
 #if ENABLE_TRACE
-  const char *filename;
-  int lineno;
-  tvh_mutex_remove_from_list(mutex, &filename, &lineno);
+  const char *filename = NULL;
+  int lineno = -1;
+  if (tvh_thread_debug > 0)
+    tvh_mutex_remove_from_list(mutex, &filename, &lineno);
 #endif
   r = pthread_cond_wait(&cond->cond, &mutex->mutex);
 #if ENABLE_TRACE
-  tvh_mutex_add_to_list(mutex, filename, lineno);
+  if (tvh_thread_debug > 0)
+    tvh_mutex_add_to_list(mutex, filename, lineno);
 #endif
   return r;
 }
@@ -323,9 +325,10 @@ tvh_cond_timedwait
   int r;
 
 #if ENABLE_TRACE
-  const char *filename;
-  int lineno;
-  tvh_mutex_remove_from_list(mutex, &filename, &lineno);
+  const char *filename = NULL;
+  int lineno = -1;
+  if (tvh_thread_debug > 0)
+    tvh_mutex_remove_from_list(mutex, &filename, &lineno);
 #endif
   
 #if defined(PLATFORM_DARWIN)
@@ -351,7 +354,8 @@ tvh_cond_timedwait
 #endif
 
 #if ENABLE_TRACE
-  tvh_mutex_add_to_list(mutex, filename, lineno);
+  if (tvh_thread_debug > 0)
+    tvh_mutex_add_to_list(mutex, filename, lineno);
 #endif
   return r;
 }
@@ -361,13 +365,15 @@ int tvh_cond_timedwait_ts(tvh_cond_t *cond, tvh_mutex_t *mutex, struct timespec
   int r;
   
 #if ENABLE_TRACE
-  const char *filename;
-  int lineno;
-  tvh_mutex_remove_from_list(mutex, &filename, &lineno);
+  const char *filename = NULL;
+  int lineno = -1;
+  if (tvh_thread_debug > 0)
+    tvh_mutex_remove_from_list(mutex, &filename, &lineno);
 #endif
   r = pthread_cond_timedwait(&cond->cond, &mutex->mutex, ts);
 #if ENABLE_TRACE
-  tvh_mutex_add_to_list(mutex, filename, lineno);
+  if (tvh_thread_debug > 0)
+    tvh_mutex_add_to_list(mutex, filename, lineno);
 #endif
   return r;
 }