UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
spinlock.hpp
1
41#ifndef UFO_UTILITY_SPINLOCK_HPP
42#define UFO_UTILITY_SPINLOCK_HPP
43
44// STL
45#include <atomic>
46
47namespace ufo
48{
68{
69 public:
76 void lock() noexcept;
77
82 [[nodiscard]] bool try_lock() noexcept;
83
87 void unlock() noexcept;
88
89 private:
93 std::atomic_flag flag_ = ATOMIC_FLAG_INIT;
94};
95} // namespace ufo
96
97#endif // UFO_UTILITY_SPINLOCK_HPP
A simple spinlock implementation using std::atomic_flag.
Definition spinlock.hpp:68
bool try_lock() noexcept
Attempts to acquire the lock without blocking.
Definition spinlock.cpp:54
void lock() noexcept
Acquires the lock. Spins until the lock is available.
Definition spinlock.cpp:47
void unlock() noexcept
Releases the lock and notifies one waiting thread.
Definition spinlock.cpp:59
All vision-related classes and functions.
Definition cloud.hpp:49