proxygen
AHMIntStressTest.cpp File Reference
#include <memory>
#include <mutex>
#include <thread>
#include <folly/AtomicHashMap.h>
#include <folly/Memory.h>
#include <folly/ScopeGuard.h>
#include <folly/portability/GTest.h>

Go to the source code of this file.

Functions

 TEST (AHMIntStressTest, Test)
 

Function Documentation

TEST ( AHMIntStressTest  ,
Test   
)

Definition at line 104 of file AHMIntStressTest.cpp.

References i, SCOPE_EXIT, folly::pushmi::detail::t, threads, and val.

104  {
105  auto const objs = new MyObjectDirectory();
106  SCOPE_EXIT {
107  delete objs;
108  };
109 
110  std::vector<std::thread> threads;
111  for (int threadId = 0; threadId < 64; ++threadId) {
112  threads.emplace_back([objs] {
113  for (int recycles = 0; recycles < 500; ++recycles) {
114  for (int i = 0; i < 10; i++) {
115  auto val = objs->get(i);
116  }
117 
118  objs->archive();
119  }
120  });
121  }
122 
123  for (auto& t : threads) {
124  t.join();
125  }
126 }
double val
Definition: String.cpp:273
#define SCOPE_EXIT
Definition: ScopeGuard.h:274
std::vector< std::thread::id > threads