EnterCriticalSection throws exception?

Rob Shearman robertshearman at gmail.com
Wed Jul 2 16:34:18 CDT 2008


2008/7/2 Huang, Zhangrong <hzhrong at gmail.com>:
...
> On some conditions, a thread does
> need hold critical section more than 65 seconds, for example: wine's
> implementation of GetAddress uses a critical section to protect
> non-reentrant gethostbyname() (well maybe need another
> gethostbyname_r() patch),  see dlls/wininet/utility.c
> As you can see, gethostbyname() may take longtime when DNS setting is
> wrong or network is broken. If a multi-thread app calls GetAddress
> simultaneous in many threads, the app will crash.

A bit of lateral thinking is needed, I feel, since contention between
threads is going to be an issue even if the lock doesn't time out. The
wininet code should be converted to using getaddrinfo and as a bonus
it will also start supporting IPv6 hosts.

-- 
Rob Shearman



More information about the wine-devel mailing list