1285101Semaste//===-- SystemLifetimeManager.h -------------------------------*- C++ -*-===//
2285101Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6285101Semaste//
7285101Semaste//===----------------------------------------------------------------------===//
8285101Semaste
9285101Semaste#ifndef LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
10285101Semaste#define LLDB_INITIALIZATION_SYSTEM_LIFETIME_MANAGER_H
11285101Semaste
12344779Sdim#include "lldb/Initialization/SystemInitializer.h"
13285101Semaste#include "lldb/lldb-private-types.h"
14344779Sdim#include "llvm/Support/Error.h"
15285101Semaste
16285101Semaste#include <memory>
17309124Sdim#include <mutex>
18285101Semaste
19314564Sdimnamespace lldb_private {
20285101Semaste
21314564Sdimclass SystemLifetimeManager {
22314564Sdimpublic:
23314564Sdim  SystemLifetimeManager();
24314564Sdim  ~SystemLifetimeManager();
25285101Semaste
26344779Sdim  llvm::Error Initialize(std::unique_ptr<SystemInitializer> initializer,
27344779Sdim                         LoadPluginCallbackType plugin_callback);
28314564Sdim  void Terminate();
29285101Semaste
30314564Sdimprivate:
31314564Sdim  std::recursive_mutex m_mutex;
32314564Sdim  std::unique_ptr<SystemInitializer> m_initializer;
33314564Sdim  bool m_initialized;
34285101Semaste
35314564Sdim  // Noncopyable.
36314564Sdim  SystemLifetimeManager(const SystemLifetimeManager &other) = delete;
37314564Sdim  SystemLifetimeManager &operator=(const SystemLifetimeManager &other) = delete;
38285101Semaste};
39285101Semaste}
40285101Semaste
41285101Semaste#endif
42