]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
profile: fix the race in profile_sharer_thread initialization, fixes #4545
authorJaroslav Kysela <perex@perex.cz>
Wed, 23 Aug 2017 15:13:45 +0000 (17:13 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 23 Aug 2017 15:13:45 +0000 (17:13 +0200)
src/profile.c

index 0b33220ef750d0aff6b5d679a17441bcc12aaaaf..612e64d56404b5fb48dfe7a75a85ad727821401c 100644 (file)
@@ -908,12 +908,13 @@ profile_sharer_postinit(profile_sharer_t *prsh)
     return 0;
   if (prsh->prsh_queue_run)
     return 0;
+  prsh->prsh_queue_run = 1;
   r = tvhthread_create(&prsh->prsh_queue_thread, NULL,
                        profile_sharer_thread, prsh, "sharer");
-  if (!r)
-    prsh->prsh_queue_run = 1;
-  else
+  if (r) {
+    prsh->prsh_queue_run = 0;
     tvherror(LS_PROFILE, "unable to create sharer thread");
+  }
   return r;
 }