Skip to content

Commit 152cdef

Browse files
cosmo0920edsiper
authored andcommitted
lib: macos: Call pthread_cancel explicitly to ensure thread termination
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 472918b commit 152cdef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/flb_lib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ int flb_start(flb_ctx_t *ctx)
680680
}
681681
else if (val == FLB_ENGINE_FAILED) {
682682
flb_error("[lib] backend failed");
683+
pthread_cancel(tid);
683684
pthread_join(tid, NULL);
684685
ctx->status = FLB_LIB_ERROR;
685686
return -1;
@@ -711,6 +712,7 @@ int flb_stop(flb_ctx_t *ctx)
711712
* the service exited for some reason (plugin action). Always
712713
* wait and double check that the child thread is not running.
713714
*/
715+
pthread_cancel(tid);
714716
pthread_join(tid, NULL);
715717
return 0;
716718
}
@@ -726,6 +728,7 @@ int flb_stop(flb_ctx_t *ctx)
726728
flb_debug("[lib] sending STOP signal to the engine");
727729

728730
flb_engine_exit(ctx->config);
731+
pthread_cancel(tid);
729732
ret = pthread_join(tid, NULL);
730733
if (ret != 0) {
731734
flb_errno();

0 commit comments

Comments
 (0)