curl / Mailing Lists / curl-library / Single Mail

curl-library

Crash in curl_multi_perform add_next_timeout

From: Gangadhar Hariharan via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 17 Oct 2017 16:24:45 -0700

Hi,

i observe crash in curl_multi_perform add_next_timeout

​Similar to

https://curl.haxx.se/mail/lib-2016-01/0102.html
https://curl.haxx.se/mail/lib-2017-10/0011.html

i have 2 threads which share the multi-handler
In the main thread, i have curl_multi_add_handle(mh, curl)
In a pthread, i have curl_multi_perform(mh, &still_running)

I protect both functions by a binary semaphore. semaphore is initted to 1

main thread():
.
.
sem_wait(&mh_sem);
curl_multi_add_handle(mh, curl)
sem_post(&mh_sem)
.
.

pthread:

while (1) {
    do {
        sem_wait(&mh_sem);
        mret = curl_multi_perform(mh, &still_running);
        sem_post(&mh_sem)
    }while (still_running && (mret == CURLM_CALL_MULTI_PERFORM));
}

Something i am doing wrong here that the crash still happens?

Thanks,
-gangadhar

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-18