blob: d243f1859aa3a3f446548e25a4eb9581d044e08f [file] [log] [blame]
[email protected]7258def2011-05-17 19:53:001// Copyright (c) 2011 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/proxy/dhcpcsvc_init_win.h"
6
7#include "base/lazy_instance.h"
8#include "base/logging.h"
9
10#include <dhcpcsdk.h>
11#include <dhcpv6csdk.h>
12
13namespace {
14
15class DhcpcsvcInitSingleton {
16 public:
17 DhcpcsvcInitSingleton() {
18 DWORD version = 0;
19 DWORD err = DhcpCApiInitialize(&version);
20 DCHECK(err == ERROR_SUCCESS); // DCHECK_EQ complains of unsigned mismatch.
21 }
[email protected]7258def2011-05-17 19:53:0022};
23
pmonette7eebe862016-07-19 16:41:0924// Worker pool threads that use the DHCP API may still be running at shutdown.
25// Leak instance and skip cleanup.
26static base::LazyInstance<DhcpcsvcInitSingleton>::Leaky
27 g_dhcpcsvc_init_singleton = LAZY_INSTANCE_INITIALIZER;
[email protected]7258def2011-05-17 19:53:0028
29} // namespace
30
31namespace net {
32
33void EnsureDhcpcsvcInit() {
34 g_dhcpcsvc_init_singleton.Get();
35}
36
37} // namespace net