1 //===-- SystemLifetimeManager.h -------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
11 #define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
12 
13 #include "lldb/Initialization/SystemInitializer.h"
14 #include "lldb/lldb-private-types.h"
15 #include "llvm/Support/Error.h"
16 
17 #include <memory>
18 #include <mutex>
19 
20 namespace lldb_private {
21 
22 class SystemLifetimeManager {
23 public:
24   SystemLifetimeManager();
25   ~SystemLifetimeManager();
26 
27   llvm::Error Initialize(std::unique_ptr<SystemInitializer> initializer,
28                          const InitializerOptions &options,
29                          LoadPluginCallbackType plugin_callback);
30   void Terminate();
31 
32 private:
33   std::recursive_mutex m_mutex;
34   std::unique_ptr<SystemInitializer> m_initializer;
35   bool m_initialized;
36 
37   // Noncopyable.
38   SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
39   SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
40 };
41 }
42 
43 #endif
44