input_curl: use select() to eliminate busy loop during connect
When decoder_run_song() (decoder_thread.c) waits for the input stream to become ready, it did that in a busy loop. Add a select() call to input_curl_buffer() during connect/handshake (i.e. before the first chunk of body data was received), to let the CPU relax.
This commit is contained in:
@@ -470,6 +470,12 @@ input_curl_buffer(struct input_stream *is)
|
|||||||
|
|
||||||
c->buffered = false;
|
c->buffered = false;
|
||||||
|
|
||||||
|
if (!is->ready)
|
||||||
|
/* not ready yet means the caller is waiting in a busy
|
||||||
|
loop; relax that by calling select() on the
|
||||||
|
socket */
|
||||||
|
input_curl_select(c);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
mcode = curl_multi_perform(c->multi, &running_handles);
|
mcode = curl_multi_perform(c->multi, &running_handles);
|
||||||
} while (mcode == CURLM_CALL_MULTI_PERFORM &&
|
} while (mcode == CURLM_CALL_MULTI_PERFORM &&
|
||||||
|
Reference in New Issue
Block a user