Counter Struct Reference

Public Member Functions

 Counter ()=default
 
void inc ()
 
int value ()
 

Public Attributes

std::thread::id created_by
 
int counter_value = 0
 

Constructor & Destructor Documentation

◆ Counter()

Counter::Counter ( )
default

Member Function Documentation

◆ inc()

void Counter::inc ( )
inline
19  {
20  // Check that mutation happens only in a thread that created this counter.
21  VERIFY_IS_EQUAL(std::this_thread::get_id(), created_by);
22  counter_value++;
23  }
#define VERIFY_IS_EQUAL(a, b)
Definition: main.h:367
int counter_value
Definition: cxx11_tensor_thread_local.cpp:27
std::thread::id created_by
Definition: cxx11_tensor_thread_local.cpp:26

References counter_value, created_by, and VERIFY_IS_EQUAL.

◆ value()

Member Data Documentation

◆ counter_value

int Counter::counter_value = 0

Referenced by inc(), and value().

◆ created_by

std::thread::id Counter::created_by

Referenced by inc(), and InitCounter::operator()().


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