dnsapi: Remove the critical section around res_query.

This commit is contained in:
Hans Leidekker 2010-09-08 19:26:43 +02:00 committed by Alexandre Julliard
parent 6154bf1ad8
commit 18cd143086
1 changed files with 1 additions and 26 deletions

View File

@ -52,19 +52,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dnsapi);
#ifdef HAVE_RESOLV #ifdef HAVE_RESOLV
static CRITICAL_SECTION resolver_cs;
static CRITICAL_SECTION_DEBUG resolver_cs_debug =
{
0, 0, &resolver_cs,
{ &resolver_cs_debug.ProcessLocksList,
&resolver_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": resolver_cs") }
};
static CRITICAL_SECTION resolver_cs = { &resolver_cs_debug, -1, 0, 0, 0, 0 };
#define LOCK_RESOLVER() do { EnterCriticalSection( &resolver_cs ); } while (0)
#define UNLOCK_RESOLVER() do { LeaveCriticalSection( &resolver_cs ); } while (0)
/* call res_init() just once because of a bug in Mac OS X 10.4 */ /* call res_init() just once because of a bug in Mac OS X 10.4 */
/* call once per thread on systems that have per-thread _res */ /* call once per thread on systems that have per-thread _res */
static void initialise_resolver( void ) static void initialise_resolver( void )
@ -552,8 +539,7 @@ exit:
return status; return status;
} }
/* The resolver lock must be held and res_init() must have been /* res_init() must have been called before calling these three functions.
* called before calling these three functions.
*/ */
static DNS_STATUS dns_set_serverlist( const IP4_ARRAY *addrs ) static DNS_STATUS dns_set_serverlist( const IP4_ARRAY *addrs )
{ {
@ -704,16 +690,11 @@ DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID ser
if (!name || !result) if (!name || !result)
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
LOCK_RESOLVER();
initialise_resolver(); initialise_resolver();
_res.options |= dns_map_options( options ); _res.options |= dns_map_options( options );
if (servers && (ret = dns_set_serverlist( servers ))) if (servers && (ret = dns_set_serverlist( servers )))
{
UNLOCK_RESOLVER();
return ret; return ret;
}
ret = dns_do_query( name, type, options, result ); ret = dns_do_query( name, type, options, result );
@ -724,8 +705,6 @@ DNS_STATUS WINAPI DnsQuery_UTF8( PCSTR name, WORD type, DWORD options, PVOID ser
ret = dns_do_query_netbios( name, result ); ret = dns_do_query_netbios( name, result );
} }
UNLOCK_RESOLVER();
#endif #endif
return ret; return ret;
} }
@ -822,12 +801,8 @@ DNS_STATUS WINAPI DnsQueryConfig( DNS_CONFIG_TYPE config, DWORD flag, PCWSTR ada
case DnsConfigDnsServerList: case DnsConfigDnsServerList:
{ {
#ifdef HAVE_RESOLV #ifdef HAVE_RESOLV
LOCK_RESOLVER();
initialise_resolver(); initialise_resolver();
ret = dns_get_serverlist( buffer, len ); ret = dns_get_serverlist( buffer, len );
UNLOCK_RESOLVER();
break; break;
#else #else
WARN( "compiled without resolver support\n" ); WARN( "compiled without resolver support\n" );