libnick 2024.12.0
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
suspendinhibitor.h
Go to the documentation of this file.
1
23#ifndef SUSPENDINHIBITOR_H
24#define SUSPENDINHIBITOR_H
25
26#include <mutex>
27#ifdef __APPLE__
28#include <IOKit/pwr_mgt/IOPMLib.h>
29#endif
30
31namespace Nickvision::System
32{
37 {
38 public:
53 SuspendInhibitor(SuspendInhibitor&& inhibitor) noexcept;
63 bool isInhibiting() const;
68 bool inhibit();
73 bool uninhibit();
86
87 private:
88 mutable std::mutex m_mutex;
89 bool m_inhibiting;
90#ifdef __linux__
91 unsigned int m_cookie;
92#elif defined(__APPLE__)
93 IOPMAssertionID m_cookie;
94#endif
95 };
96}
97
98#endif //SUSPENDINHIBITOR_H
An object to prevent the system from suspending.
Definition suspendinhibitor.h:37
SuspendInhibitor & operator=(const SuspendInhibitor &inhibitor)
Copies a SuspendInhibitor object.
~SuspendInhibitor()
Destructs a SuspendInhibitor.
bool inhibit()
Inhibits the system from suspending.
bool isInhibiting() const
Gets whether or not the system is being inhibited from suspending.
bool uninhibit()
Uninhibits the system from suspending.
SuspendInhibitor()
Constructs a SuspendInhibitor.
SuspendInhibitor & operator=(SuspendInhibitor &&inhibitor) noexcept
Moves a SuspendInhibitor object.
SuspendInhibitor(SuspendInhibitor &&inhibitor) noexcept
Moves a SuspendInhibitor object.
SuspendInhibitor(const SuspendInhibitor &inhibitor)
Copies a SuspendInhibitor object.
Definition deploymentmode.h:27