#pragma once
#include "Utils/DbgHelper.h"
#include "Utils/Lock.h"

class DbgHelpManager {
	friend class DbgHelp;
public:
	// Create the DbgHelp instance now.
	static void create();

	// Destroy the DbgHelp instance now.
	static void destroy();

private:
	DbgHelpManager();

	~DbgHelpManager();

#ifdef WINDOWS

	// The instance of this class.
	static DbgHelpManager instance;

	// The created instance. Stored using atomics so that we can skip the lock in the fast-path.
	DbgHelp *created;

	// Lock for everything.
	util::Lock lock;

	// Counter for creation.
	storm::Nat createCount;

	// Create without refcount. This is a bit of an "emergency mode", as it might not be properly
	// cleaned up before the process exists.
	DbgHelp *createNoRef();

#endif
};
