proxygen
FOLLY_PACK_POP::SimpleBarrier Struct Reference

Public Member Functions

 SimpleBarrier ()
 
void wait ()
 
void run ()
 

Private Attributes

std::mutex lock_
 
std::condition_variable cv_
 
bool ready_
 

Detailed Description

Definition at line 202 of file SmallLocksTest.cpp.

Constructor & Destructor Documentation

FOLLY_PACK_POP::SimpleBarrier::SimpleBarrier ( )
inline

Definition at line 203 of file SmallLocksTest.cpp.

Member Function Documentation

void FOLLY_PACK_POP::SimpleBarrier::run ( )
inline

Definition at line 212 of file SmallLocksTest.cpp.

References cv_.

212  {
213  {
214  std::unique_lock<std::mutex> lockHeld(lock_);
215  ready_ = true;
216  }
217 
218  cv_.notify_all();
219  }
std::condition_variable cv_
void FOLLY_PACK_POP::SimpleBarrier::wait ( )
inline

Definition at line 205 of file SmallLocksTest.cpp.

References cv_.

205  {
206  std::unique_lock<std::mutex> lockHeld(lock_);
207  while (!ready_) {
208  cv_.wait(lockHeld);
209  }
210  }
std::condition_variable cv_

Member Data Documentation

std::condition_variable FOLLY_PACK_POP::SimpleBarrier::cv_
private

Definition at line 223 of file SmallLocksTest.cpp.

std::mutex FOLLY_PACK_POP::SimpleBarrier::lock_
private

Definition at line 222 of file SmallLocksTest.cpp.

bool FOLLY_PACK_POP::SimpleBarrier::ready_
private

Definition at line 224 of file SmallLocksTest.cpp.


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