From: Mark D. <ma...@ki...> - 2006-08-21 05:37:58
|
On Mon, 21 Aug 2006 00:35:11 -0500, Gary Kramlich wrote > Mark Doliner wrote: > > <snip> > > >> Why do we need a thread? Can't we use a watcher or listener in our main > >> loop? > > > > We use either getaddrinfo() or gethostbyname(), and they are both blocking. > > > > -Mark > > I haven't looked at the changes, but I hope, now that it's threaded that > we're using gethostbyname_r or gethostbyname2_r, since the man page says: > > The functions gethostbyname() and gethostbyaddr() may return > pointers to static data, which > may be overwritten by later calls. Copying the struct hostent > does not suffice, since it con‐ > tains pointers; a deep copy is required. > > This of course, is implementation specific. I'm working on that right now, actually. Unfortunately gethostbyname_r() is a GNU extension, which means we shouldn't use it. Which means that we'll have to use gethostbyname() in a blocking manner on systems without addrinfo. Fortunately this should be a relatively small number of systems. -Mark |