On Fri, Sep 25, 2009 at 12:56:45PM -0700, Constantine Sapuntzakis wrote: > Attached is a merged version of hostthre.c. I've also cleaned up the > macros to be functions and the types to be prefixed with curl_. I > haven't tested it on a Mac, so it probably doesn't compile but I think > it's close.
Hey, this is nice. Much cleaner and nicer than my implementation (mainly because I was shooting for wrapping pthreads around the existing logic, which depended on Windows-specific threading quirks. Some notes: - curl_thread_t_null should be used in curl_thread_join for windows, instead of a literal NULL - The definition of *tsd in gethostbyname_complete looks truly evil. I think that's worth splitting out. (Also getaddrinfo_complete) - You've reverted to itoa() in getaddrinfo_thread. Please use snprintf with NI_MAXSERV - this is more portable. itoa() doesn't exist in POSIX. char service[NI_MAXSERV]; snprintf(service, sizeof(service), "%d", tsd->port); - The "shouldn't be reached" bit in Curl_is_resolved should probably be a DEBUGASSERT as well. I'll probably have a couple more tweaks to make once I get around to testing this on my Mac and Linux machines. > This does not address non thread-safe resolvers. That's probably best > dealt with in the configure mechanism. I can write a follow up patch for that in a bit. Jamie's advice seems sound. Do we have any sense of what we're going to do about the dummy_sock stuff? Is there a better way? -- Joshua Kwan ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
