summaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-03-12 23:55:09 +0100
committerDaniel Stenberg <daniel@haxx.se>2023-03-13 23:01:02 +0100
commitbc90308328afb8e1b99de2d518b1427516288c12 (patch)
tree251a2886b8224ae6408e62ca284f94b521c015d9 /lib/multi.c
parent9f96537cc341801af46b12e7f0d8ff3623abc379 (diff)
downloadcurl-bc90308328afb8e1b99de2d518b1427516288c12.tar.gz
multi: make multi_perform ignore/unignore signals less often
For improved performance Reported-by: Jerome St-Louis Ref: #10743 Closes #10750
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 3bf72ce65..6e272cb66 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -2706,18 +2706,25 @@ CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles)
return CURLM_RECURSIVE_API_CALL;
data = multi->easyp;
- while(data) {
+ if(data) {
CURLMcode result;
+ bool nosig = data->set.no_signal;
SIGPIPE_VARIABLE(pipe_st);
-
sigpipe_ignore(data, &pipe_st);
- result = multi_runsingle(multi, &now, data);
+ /* Do the loop and only alter the signal ignore state if the next handle
+ has a different NO_SIGNAL state than the previous */
+ do {
+ if(data->set.no_signal != nosig) {
+ sigpipe_restore(&pipe_st);
+ sigpipe_ignore(data, &pipe_st);
+ nosig = data->set.no_signal;
+ }
+ result = multi_runsingle(multi, &now, data);
+ if(result)
+ returncode = result;
+ data = data->next; /* operate on next handle */
+ } while(data);
sigpipe_restore(&pipe_st);
-
- if(result)
- returncode = result;
-
- data = data->next; /* operate on next handle */
}
/*