Skip to content

Commit

Permalink
libsubprocess: add note on output callbacks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chu11 committed Sep 27, 2024
1 parent 1ec8a8c commit ee08669
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/common/libsubprocess/subprocess.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ee08669

Please sign in to comment.