2017-08-23 16:17:53 -07:00
|
|
|
#pragma once
|
|
|
|
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <vcpkg/base/chrono.h>
|
|
|
|
#include <vcpkg/base/util.h>
|
2017-08-25 16:03:57 -07:00
|
|
|
|
2017-10-13 18:37:41 -07:00
|
|
|
#include <atomic>
|
2017-08-23 16:17:53 -07:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
|
|
|
struct GlobalState
|
|
|
|
{
|
2017-11-29 23:45:47 -08:00
|
|
|
static Util::LockGuarded<Chrono::ElapsedTimer> timer;
|
2017-12-01 16:08:09 -08:00
|
|
|
static Util::LockGuarded<std::string> g_surveydate;
|
|
|
|
|
2017-08-25 16:03:57 -07:00
|
|
|
static std::atomic<bool> debugging;
|
|
|
|
static std::atomic<bool> feature_packages;
|
2018-02-26 18:38:25 -08:00
|
|
|
static std::atomic<bool> g_binary_caching;
|
2017-08-25 16:55:14 -07:00
|
|
|
|
|
|
|
static std::atomic<int> g_init_console_cp;
|
|
|
|
static std::atomic<int> g_init_console_output_cp;
|
2018-10-16 00:35:47 -07:00
|
|
|
static std::atomic<bool> g_init_console_initialized;
|
|
|
|
|
|
|
|
struct CtrlCStateMachine
|
|
|
|
{
|
|
|
|
void transition_to_spawn_process() noexcept;
|
|
|
|
void transition_from_spawn_process() noexcept;
|
|
|
|
void transition_handle_ctrl_c() noexcept;
|
|
|
|
|
|
|
|
private:
|
|
|
|
enum class CtrlCState
|
|
|
|
{
|
|
|
|
normal,
|
|
|
|
blocked_on_child,
|
|
|
|
exit_requested,
|
|
|
|
};
|
|
|
|
|
|
|
|
std::atomic<CtrlCState> m_state = CtrlCState::normal;
|
|
|
|
};
|
|
|
|
|
|
|
|
static CtrlCStateMachine g_ctrl_c_state;
|
2017-08-23 16:17:53 -07:00
|
|
|
};
|
2017-11-29 23:45:47 -08:00
|
|
|
}
|