Skip to content

Commit

Permalink
ending switchboard loop when select returns 0 (#59)
Browse files Browse the repository at this point in the history
this happens when subprocess doesnt do much IO and so subprocess
completes even though it has no ready FDs so we should finish loop
even when its ==0 vs previously it was only accounting for >0

note that we still only handle ready writes/reads when select returns >0
as there is no point in handling FDs when they have nothing ready yet
  • Loading branch information
miki725 authored Feb 26, 2024
1 parent 3f5d421 commit c054e51
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nimutils/c/switchboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,10 @@ sb_operate_switchboard(switchboard_t *ctx, bool loop)
if (ctx->fds_ready > 0) {
handle_ready_reads(ctx);
handle_ready_writes(ctx);
}
if (ctx->fds_ready >= 0) {
handle_loop_end(ctx);
} else if (ctx->fds_ready == -1) {
} else {
// select returned error
if (errno == EINTR) {
continue;
Expand Down

0 comments on commit c054e51

Please sign in to comment.