1//===-- SystemLifetimeManager.h -------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
10#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
11
12#include "lldb/Initialization/SystemInitializer.h"
13#include "lldb/lldb-private-types.h"
14#include "llvm/Support/Error.h"
15
16#include <memory>
17#include <mutex>
18
19namespace lldb_private {
20
21class SystemLifetimeManager {
22public:
23  SystemLifetimeManager();
24  ~SystemLifetimeManager();
25
26  llvm::Error Initialize(std::unique_ptr<SystemInitializer> initializer,
27                         LoadPluginCallbackType plugin_callback);
28  void Terminate();
29
30private:
31  std::recursive_mutex m_mutex;
32  std::unique_ptr<SystemInitializer> m_initializer;
33  bool m_initialized;
34
35  // Noncopyable.
36  SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
37  SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
38};
39}
40
41#endif
42