From ee086690d46db51eb4564efca197fdfd6a47cb8c Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Wed, 25 Sep 2024 10:59:54 -0700 Subject: [PATCH] libsubprocess: add note on output callbacks Problem: If output callbacks do not read from their respective buffers, it can lead to excessive callbacks and code spinning. Add comment about this in subprocess.h. --- src/common/libsubprocess/subprocess.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/libsubprocess/subprocess.h b/src/common/libsubprocess/subprocess.h index 98712e5f7353..a0125f3d0677 100644 --- a/src/common/libsubprocess/subprocess.h +++ b/src/common/libsubprocess/subprocess.h @@ -88,6 +88,11 @@ typedef void (*flux_subprocess_hook_f) (flux_subprocess_t *p, void *arg); /* * Functions for event-driven subprocess handling: * + * When output callbacks are called, flux_subprocess_read(), + * flux_subprocess_read_line() and similar functions should be used + * to read buffered data. If this is not done, it can lead to + * excessive callbacks and code "spinning". + * */ typedef struct { flux_subprocess_f on_completion; /* Process exited and all I/O