rippled
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
beast::unit_test::thread Class Reference

Replacement for std::thread that handles exceptions in unit tests. More...

#include <thread.h>

Collaboration diagram for beast::unit_test::thread:
Collaboration graph
[legend]

Public Types

using id = std::thread::id
 
using native_handle_type = std::thread::native_handle_type
 

Public Member Functions

 thread ()=default
 
 thread (thread const &)=delete
 
threadoperator= (thread const &)=delete
 
 thread (thread &&other)
 
threadoperator= (thread &&other)
 
template<class F , class... Args>
 thread (suite &s, F &&f, Args &&... args)
 
bool joinable () const
 
std::thread::id get_id () const
 
void join ()
 
void detach ()
 
void swap (thread &other)
 

Static Public Member Functions

static unsigned hardware_concurrency () noexcept
 

Private Member Functions

void run (std::function< void(void)> f)
 

Private Attributes

suites_ = nullptr
 
std::thread t_
 

Detailed Description

Replacement for std::thread that handles exceptions in unit tests.

Definition at line 18 of file thread.h.

Member Typedef Documentation

◆ id

Definition at line 25 of file thread.h.

◆ native_handle_type

using beast::unit_test::thread::native_handle_type = std::thread::native_handle_type

Definition at line 26 of file thread.h.

Constructor & Destructor Documentation

◆ thread() [1/4]

beast::unit_test::thread::thread ( )
default

◆ thread() [2/4]

beast::unit_test::thread::thread ( thread const &  )
delete

◆ thread() [3/4]

beast::unit_test::thread::thread ( thread &&  other)

Definition at line 33 of file thread.h.

◆ thread() [4/4]

template<class F , class... Args>
beast::unit_test::thread::thread ( suite s,
F &&  f,
Args &&...  args 
)
explicit

Definition at line 46 of file thread.h.

Member Function Documentation

◆ operator=() [1/2]

thread & beast::unit_test::thread::operator= ( thread const &  )
delete

◆ operator=() [2/2]

thread & beast::unit_test::thread::operator= ( thread &&  other)

Definition at line 38 of file thread.h.

◆ joinable()

bool beast::unit_test::thread::joinable ( ) const

Definition at line 54 of file thread.h.

◆ get_id()

std::thread::id beast::unit_test::thread::get_id ( ) const

Definition at line 60 of file thread.h.

◆ hardware_concurrency()

static unsigned beast::unit_test::thread::hardware_concurrency ( )
staticnoexcept

Definition at line 66 of file thread.h.

◆ join()

void beast::unit_test::thread::join ( )

Definition at line 72 of file thread.h.

◆ detach()

void beast::unit_test::thread::detach ( )

Definition at line 79 of file thread.h.

◆ swap()

void beast::unit_test::thread::swap ( thread other)

Definition at line 85 of file thread.h.

◆ run()

void beast::unit_test::thread::run ( std::function< void(void)>  f)
private

Definition at line 93 of file thread.h.

Member Data Documentation

◆ s_

suite* beast::unit_test::thread::s_ = nullptr
private

Definition at line 21 of file thread.h.

◆ t_

std::thread beast::unit_test::thread::t_
private

Definition at line 22 of file thread.h.