proxygen
SimpleThreadCachedInt Class Reference

Public Member Functions

void add (int val)
 
int read ()
 

Private Attributes

ThreadLocal< int, NewTag > val_
 

Detailed Description

Definition at line 320 of file ThreadLocalTest.cpp.

Member Function Documentation

void SimpleThreadCachedInt::add ( int  val)
inline

Definition at line 325 of file ThreadLocalTest.cpp.

References val.

Referenced by TEST().

325  {
326  *val_ += val;
327  }
double val
Definition: String.cpp:273
ThreadLocal< int, NewTag > val_
int SimpleThreadCachedInt::read ( )
inline

Definition at line 329 of file ThreadLocalTest.cpp.

References folly::ThreadLocal< T, Tag, AccessMode >::accessAllThreads(), and i.

329  {
330  int ret = 0;
331  for (const auto& i : val_.accessAllThreads()) {
332  ret += i;
333  }
334  return ret;
335  }
Accessor accessAllThreads() const
Definition: ThreadLocal.h:87
ThreadLocal< int, NewTag > val_

Member Data Documentation

ThreadLocal<int, NewTag> SimpleThreadCachedInt::val_
private

Definition at line 321 of file ThreadLocalTest.cpp.


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