]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/port/win/env_default.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / rocksdb / port / win / env_default.cc
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5 //
6 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. See the AUTHORS file for names of contributors.
9
10 #include <mutex>
11
12 #include <rocksdb/env.h>
13 #include "port/win/env_win.h"
14 #include "util/compression_context_cache.h"
15 #include "util/sync_point.h"
16 #include "util/thread_local.h"
17
18 namespace rocksdb {
19 namespace port {
20
21 // We choose not to destroy the env because joining the threads from the
22 // system loader
23 // which destroys the statics (same as from DLLMain) creates a system loader
24 // dead-lock.
25 // in this manner any remaining threads are terminated OK.
26 namespace {
27 std::once_flag winenv_once_flag;
28 Env* envptr;
29 };
30 }
31
32 Env* Env::Default() {
33 using namespace port;
34 ThreadLocalPtr::InitSingletons();
35 CompressionContextCache::InitSingleton();
36 INIT_SYNC_POINT_SINGLETONS();
37 std::call_once(winenv_once_flag, []() { envptr = new WinEnv(); });
38 return envptr;
39 }
40
41 }