lib: macos: Call pthread_cancel explicitly to ensure thread termination
@@ -680,6 +680,7 @@ int flb_start(flb_ctx_t *ctx)
}
else if (val == FLB_ENGINE_FAILED) {
flb_error("[lib] backend failed");
+ pthread_cancel(tid);
pthread_join(tid, NULL);
ctx->status = FLB_LIB_ERROR;
return -1;
@@ -711,6 +712,7 @@ int flb_stop(flb_ctx_t *ctx)
* the service exited for some reason (plugin action). Always
* wait and double check that the child thread is not running.
*/
+ pthread_cancel(tid);
pthread_join(tid, NULL);
return 0;
}
@@ -726,6 +728,7 @@ int flb_stop(flb_ctx_t *ctx)
flb_debug("[lib] sending STOP signal to the engine");
flb_engine_exit(ctx->config);
+ pthread_cancel(tid);
ret = pthread_join(tid, NULL);
if (ret != 0) {
flb_errno();
