malcontent/nss/cares_init.hh

29 lines
599 B
C++

// SPDX-FileCopyrightText: Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <memory>
#include <mutex>
namespace malcontent {
class CAresLibrary {
struct Private {};
public:
static auto instance() -> std::shared_ptr<CAresLibrary>;
CAresLibrary(Private);
~CAresLibrary() noexcept;
CAresLibrary(const CAresLibrary&) = delete;
CAresLibrary(CAresLibrary&&) = delete;
private:
static std::mutex _init_mutex;
static std::weak_ptr<CAresLibrary> _instance;
};
} // ~ namespace malcontent