mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
moved all stuff to github
This commit is contained in:
parent
095fbeeb67
commit
296ae46ed8
388 changed files with 95937 additions and 469 deletions
38
tests/unit_tests/unit_tests_utils.h
Normal file
38
tests/unit_tests/unit_tests_utils.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2012-2013 The Cryptonote developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace unit_test
|
||||
{
|
||||
class call_counter
|
||||
{
|
||||
public:
|
||||
call_counter()
|
||||
: m_counter(0)
|
||||
{
|
||||
}
|
||||
|
||||
void inc() volatile
|
||||
{
|
||||
// memory_order_relaxed is enough for call counter
|
||||
m_counter.fetch_add(1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
size_t get() volatile const
|
||||
{
|
||||
return m_counter.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void reset() volatile
|
||||
{
|
||||
m_counter.store(0, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic<size_t> m_counter;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue