iw5-mod/src/game/engine/scoped_critical_section.hpp

24 lines
479 B
C++
Raw Normal View History

#pragma once
namespace game::engine
{
class scoped_critical_section
{
public:
scoped_critical_section(native::CriticalSection s, native::ScopedCriticalSectionType type);
~scoped_critical_section();
void enter_crit_sect();
void leave_crit_sect();
bool try_enter_crit_sect();
[[nodiscard]] bool has_ownership() const;
[[nodiscard]] bool is_scoped_release() const;
private:
native::CriticalSection s_;
bool has_ownership_;
bool is_scoped_release_;
};
}