#pragma once

#if PK_ENABLE_THREAD
#define PK_THREAD_LOCAL thread_local
#include <mutex>

struct GIL {
    inline static std::mutex _mutex;

    explicit GIL() { _mutex.lock(); }

    ~GIL() { _mutex.unlock(); }
};

#define PK_GLOBAL_SCOPE_LOCK() GIL _lock;

#else
#define PK_THREAD_LOCAL static
#define PK_GLOBAL_SCOPE_LOCK()
#endif
