You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

18 lines
353 B

#ifndef SRC_ATOMIC_POLYFILL_H_
#define SRC_ATOMIC_POLYFILL_H_
#include "util.h"
namespace nonstd {
template <typename T>
struct atomic {
atomic() = default;
T exchange(T value) { return __sync_lock_test_and_set(&value_, value); }
T value_ = T();
DISALLOW_COPY_AND_ASSIGN(atomic);
};
} // namespace nonstd
#endif // SRC_ATOMIC_POLYFILL_H_