libhatchet
Loading...
Searching...
No Matches

#include <hxthread.hpp>

Public Types

using return_t = int

Public Member Functions

 hxthread (void)
template<typename parameter_t_>
 hxthread (return_t(*entry_point_)(parameter_t_ *), parameter_t_ *parameter_)
 ~hxthread (void)
template<typename parameter_t_>
void start (return_t(*entry_point_)(parameter_t_ *), parameter_t_ *parameter_)
bool joinable (void) const
void join (void)

Detailed Description

hxthread - std::thread style thread wrapper for the configured backend.

Provides thread creation and joining.

Member Typedef Documentation

◆ return_t

using hxthread::return_t = int

The return type of a thread entry point as required by the configured backend.

Constructor & Destructor Documentation

◆ hxthread() [1/2]

hxthread::hxthread ( void )
inline

Default constructor. Thread is not started.

◆ hxthread() [2/2]

template<typename parameter_t_>
hxthread::hxthread ( return_t(* entry_point_ )(parameter_t_ *),
parameter_t_ * parameter_ )
inlineexplicit

Constructs and starts a thread with the given function and argument.

Does not free the argument. Any function that takes a single pointer and returns return_t should work. The return value is ignored but may be unsafe to cast to a function with a different return type.

  • entry_point : Function pointer of type: entry_point(T*).
  • parameter : T* to pass to the function.

◆ ~hxthread()

hxthread::~hxthread ( void )
inline

Destructor. Asserts that the thread was stopped correctly.

Member Function Documentation

◆ join()

void hxthread::join ( void )
inline

Joins the thread. Blocks until the thread finishes.

◆ joinable()

bool hxthread::joinable ( void ) const
inline

Returns true if the thread has been started and not yet joined.

Callers must check the return value before acting on the thread state.

◆ start()

template<typename parameter_t_>
void hxthread::start ( return_t(* entry_point_ )(parameter_t_ *),
parameter_t_ * parameter_ )
inline

Starts a thread with the given function and argument.

Does not free the argument. Any function that takes a single T pointer and returns return_t should work. The return value is ignored but is required by the native calling convention.

  • entry_point : Function pointer of type: entry_point(T*).
  • parameter : T* to pass to the function.

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