6#ifndef IFW_CORE_UTILS_SYSTEM_HPP_
7#define IFW_CORE_UTILS_SYSTEM_HPP_
14#include <rad/logger.hpp>
25 const std::string& message,
26 std::array<std::string, 3>& location);
30 const std::string&
object,
31 std::array<std::string, 3>& location);
37 int64_t
Random(
const int64_t min_val,
38 const int64_t max_val);
46 std::string
ExecCommand(
const std::string& command);
74 explicit Mutex(
const std::string&
id);
78 const std::string&
Id()
const;
87 static bool s_initialized;
88 static bool s_debug_mode;
89 static std::recursive_mutex s_gen_mutex;
90 static void _lock_gen_mutex();
91 static void _unlock_gen_mutex();
93 static std::map<std::string, std::shared_ptr<std::recursive_mutex> > s_mutexes;
95 std::recursive_mutex* m_cur_sem_ptr;
101#define BEGIN_CRIT_SEC(id) { \
102 ifw::core::utils::system::Mutex tmp_mutex(id); \
105#define END_CRIT_SEC(id) }
The Mutex class: Scope based mutex semaphore. The ifw::core::utils::system::Mutex semaphore is used t...
Definition system.hpp:69
const std::string & Id() const
Definition system.cpp:191
void Unlock()
Definition system.cpp:181
static void Clear()
Releases (deletes) all semaphores allocated. Use with caution!!
Definition system.cpp:165
void Lock()
Definition system.cpp:171
Mutex(const std::string &id)
Definition system.cpp:120
~Mutex()
Definition system.cpp:152
std::string Platform()
Get the name of the platform (OS).
Definition system.cpp:45
void AssertPtr(const void *ptr, const std::string &object, std::array< std::string, 3 > &location)
Check if pointer is NULL. If yes, throw std::runtime_error.
Definition system.cpp:26
std::string ExecCommand(const std::string &command)
Execute a shell command (synchroneously).
Definition system.cpp:89
int64_t Random(const int64_t min_val, const int64_t max_val)
Generate an int64_t random number in the inteval specified.
Definition system.cpp:65
double _Time()
Definition system.cpp:37
void Assert(const bool condition, const std::string &message, std::array< std::string, 3 > &location)
Check if pointer is NULL. If yes, throw std::runtime_error.