Banuba SDK
Loading...
Searching...
No Matches
bnb::spin_mutex Class Reference

Public Member Functions

void lock ()
 
void unlock ()
 
bool try_lock ()
 

Detailed Description

Definition at line 31 of file concurrency.hpp.

Member Function Documentation

◆ lock()

void bnb::spin_mutex::lock ( )
inline

Definition at line 34 of file concurrency.hpp.

35 {
36 while (flag.test_and_set(std::memory_order_acquire))
37 ;
38 }

◆ try_lock()

bool bnb::spin_mutex::try_lock ( )
inline

Definition at line 43 of file concurrency.hpp.

44 {
45 return !(flag.test_and_set(std::memory_order_acquire));
46 }

◆ unlock()

void bnb::spin_mutex::unlock ( )
inline

Definition at line 39 of file concurrency.hpp.

40 {
41 flag.clear(std::memory_order_release);
42 }

The documentation for this class was generated from the following file: