Add STA_ATOMIC_ENABLE guards

This commit is contained in:
Henrik Stickann 2022-04-10 20:44:44 +02:00
parent 4bf8a31acf
commit 82b7e2a3df
4 changed files with 18 additions and 0 deletions

View File

@ -1,6 +1,9 @@
#ifndef STA_ATOMIC_MUTEX_HPP #ifndef STA_ATOMIC_MUTEX_HPP
#define STA_ATOMIC_MUTEX_HPP #define STA_ATOMIC_MUTEX_HPP
#include <sta/config.hpp>
#ifdef STA_ATOMIC_ENABLE
#include <sta/mutex.hpp> #include <sta/mutex.hpp>
#include <atomic> #include <atomic>
@ -22,4 +25,6 @@ namespace sta
} // namespace sta } // namespace sta
#endif // STA_ATOMIC_ENABLE
#endif // STA_ATOMIC_MUTEX_HPP #endif // STA_ATOMIC_MUTEX_HPP

View File

@ -1,6 +1,9 @@
#ifndef STA_ATOMIC_SIGNAL_HPP #ifndef STA_ATOMIC_SIGNAL_HPP
#define STA_ATOMIC_SIGNAL_HPP #define STA_ATOMIC_SIGNAL_HPP
#include <sta/config.hpp>
#ifdef STA_ATOMIC_ENABLE
#include <sta/signal.hpp> #include <sta/signal.hpp>
#include <atomic> #include <atomic>
@ -24,4 +27,6 @@ namespace sta
} // namespace sta } // namespace sta
#endif // STA_ATOMIC_ENABLE
#endif // STA_ATOMIC_SIGNAL_HPP #endif // STA_ATOMIC_SIGNAL_HPP

View File

@ -1,4 +1,5 @@
#include <sta/atomic/mutex.hpp> #include <sta/atomic/mutex.hpp>
#ifdef STA_ATOMIC_ENABLE
namespace sta namespace sta
@ -17,3 +18,6 @@ namespace sta
lock_.clear(); lock_.clear();
} }
} // namespace sta } // namespace sta
#endif // STA_ATOMIC_ENABLE

View File

@ -1,4 +1,5 @@
#include <sta/atomic/signal.hpp> #include <sta/atomic/signal.hpp>
#ifdef STA_ATOMIC_ENABLE
namespace sta namespace sta
@ -27,3 +28,6 @@ namespace sta
while (!signal_.exchange(false)); while (!signal_.exchange(false));
} }
} // namespace sta } // namespace sta
#endif // STA_ATOMIC_ENABLE