Skip to content

Commit 4c7d173

Browse files
cosmo0920edsiper
authored andcommitted
lib: macos: Call pthread_cancel only for macOS
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 152cdef commit 4c7d173

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/flb_lib.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ int flb_start(flb_ctx_t *ctx)
667667
fd = event->fd;
668668
bytes = flb_pipe_r(fd, &val, sizeof(uint64_t));
669669
if (bytes <= 0) {
670+
#if defined(FLB_SYSTEM_MACOS)
670671
pthread_cancel(tid);
672+
#endif
671673
pthread_join(tid, NULL);
672674
ctx->status = FLB_LIB_ERROR;
673675
return -1;
@@ -680,7 +682,9 @@ int flb_start(flb_ctx_t *ctx)
680682
}
681683
else if (val == FLB_ENGINE_FAILED) {
682684
flb_error("[lib] backend failed");
685+
#if defined(FLB_SYSTEM_MACOS)
683686
pthread_cancel(tid);
687+
#endif
684688
pthread_join(tid, NULL);
685689
ctx->status = FLB_LIB_ERROR;
686690
return -1;
@@ -712,7 +716,9 @@ int flb_stop(flb_ctx_t *ctx)
712716
* the service exited for some reason (plugin action). Always
713717
* wait and double check that the child thread is not running.
714718
*/
719+
#if defined(FLB_SYSTEM_MACOS)
715720
pthread_cancel(tid);
721+
#endif
716722
pthread_join(tid, NULL);
717723
return 0;
718724
}
@@ -728,7 +734,9 @@ int flb_stop(flb_ctx_t *ctx)
728734
flb_debug("[lib] sending STOP signal to the engine");
729735

730736
flb_engine_exit(ctx->config);
737+
#if defined(FLB_SYSTEM_MACOS)
731738
pthread_cancel(tid);
739+
#endif
732740
ret = pthread_join(tid, NULL);
733741
if (ret != 0) {
734742
flb_errno();

0 commit comments

Comments
 (0)