curl-library
'curl_multi_perform' blocking?
Date: Mon, 31 Mar 2008 10:08:29 -0700
I have code that runs on a background thread. It does something like this:
while (!quit) {
int numHandles = 1;
lock(map);
while (errorCode == CURLM_CALL_MULTI_PERFORM)
errorCode = curl_multi_perform(multiHandle, &numHandles);
unlock(map);
}
and there is another entry point in my main thread which also locks
'map' to process the active connections (advance data buffers, etc.)
I've noticed that if I construct a URL with a host that doesn't resolve,
curl_multi_perform doesn't return for two full seconds when I add this
URL into the 'multiHandle'.
Is that expected? I would think curl_multi_perform should return almost
immediately and that DNS should happen asynchronously, but this doesn't
seem to be the case.
This creates a problem because the main thread gets stalled for the same
amount of time trying to acquire the lock on 'map'.
I can post the actual code and log output if necessary, but the log
output is quite lengthy.
Received on 2008-03-31