From: Jaroslav Kysela Date: Wed, 23 Aug 2017 15:13:45 +0000 (+0200) Subject: profile: fix the race in profile_sharer_thread initialization, fixes #4545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3df769a8cc0097d052c7d24341ed4818bec87557;p=thirdparty%2Ftvheadend.git profile: fix the race in profile_sharer_thread initialization, fixes #4545 --- diff --git a/src/profile.c b/src/profile.c index 0b33220ef..612e64d56 100644 --- a/src/profile.c +++ b/src/profile.c @@ -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; }