lib: macos: Call pthread_cancel only for macOS
@@ -667,7 +667,9 @@ int flb_start(flb_ctx_t *ctx)
fd = event->fd;
bytes = flb_pipe_r(fd, &val, sizeof(uint64_t));
if (bytes <= 0) {
+#if defined(FLB_SYSTEM_MACOS)
pthread_cancel(tid);
+#endif
pthread_join(tid, NULL);
ctx->status = FLB_LIB_ERROR;
return -1;
@@ -680,7 +682,9 @@ int flb_start(flb_ctx_t *ctx)
}
else if (val == FLB_ENGINE_FAILED) {
flb_error("[lib] backend failed");
+#if defined(FLB_SYSTEM_MACOS)
pthread_cancel(tid);
+#endif
pthread_join(tid, NULL);
ctx->status = FLB_LIB_ERROR;
return -1;
@@ -712,7 +716,9 @@ 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.
*/
+#if defined(FLB_SYSTEM_MACOS)
pthread_cancel(tid);
+#endif
pthread_join(tid, NULL);
return 0;
}
@@ -728,7 +734,9 @@ int flb_stop(flb_ctx_t *ctx)
flb_debug("[lib] sending STOP signal to the engine");
flb_engine_exit(ctx->config);
+#if defined(FLB_SYSTEM_MACOS)
pthread_cancel(tid);
+#endif
ret = pthread_join(tid, NULL);
if (ret != 0) {
flb_errno();
