neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
neolib::thread Class Reference

#include <thread.hpp>

Inheritance diagram for neolib::thread:
neolib::i_thread neolib::waitable neolib::noncopyable neolib::async_thread neogfx::async_thread neogfx::app_thread

Classes

struct  cancellation
 
struct  cannot_wait_on_self
 
struct  no_thread_object
 
struct  not_in_thread
 
struct  thread_already_started
 
struct  thread_not_started
 

Public Types

typedef std::thread::id id_type
 
typedef std::thread thread_object_type
 

Public Member Functions

 thread (const std::string &aName="", bool aAttachToCurrentThread=false)
 
 thread (std::function< void()> aExecFunction, const std::string &aName="")
 
virtual ~thread ()
 
const std::string & name () const noexcept override
 
bool using_existing_thread () const noexcept
 
void start ()
 
void cancel ()
 
void abort (bool aWait=true) override
 
void wait () const
 
wait_result wait (const waitable_event_list &aEventList) const
 
bool msg_wait (const i_message_queue &aMessageQueue) const
 
wait_result msg_wait (const i_message_queue &aMessageQueue, const waitable_event_list &aEventList) const
 
void block ()
 
void unblock ()
 
thread_state state () const noexcept override
 
bool started () const noexcept
 
bool running () const noexcept
 
bool finished () const noexcept override
 
bool aborted () const noexcept
 
bool cancelled () const noexcept
 
bool error () const noexcept
 
id_type id () const noexcept
 
bool in () const
 
bool blocked () const noexcept
 
bool has_thread_object () const noexcept
 
thread_object_typethread_object () const
 
- Public Member Functions inherited from neolib::i_thread
virtual ~i_thread ()=default
 

Static Public Member Functions

static void sleep (const std::chrono::duration< double, std::milli > &aDuration)
 
static void yield ()
 
static uint64_t elapsed_ms () noexcept
 
static uint64_t elapsed_us () noexcept
 
static uint64_t elapsed_ns () noexcept
 
static uint64_t program_elapsed_ms () noexcept
 
static uint64_t program_elapsed_us () noexcept
 
static uint64_t program_elapsed_ns () noexcept
 

Additional Inherited Members

Detailed Description

Definition at line 51 of file thread.hpp.

Member Typedef Documentation

◆ id_type

Definition at line 55 of file thread.hpp.

◆ thread_object_type

Definition at line 56 of file thread.hpp.

Constructor & Destructor Documentation

◆ thread() [1/2]

neolib::thread::thread ( const std::string &  aName = "",
bool  aAttachToCurrentThread = false 
)

◆ thread() [2/2]

neolib::thread::thread ( std::function< void()>  aExecFunction,
const std::string &  aName = "" 
)

◆ ~thread()

virtual neolib::thread::~thread ( )
virtual

Member Function Documentation

◆ abort()

void neolib::thread::abort ( bool  aWait = true)
overridevirtual

Implements neolib::i_thread.

◆ aborted()

bool neolib::thread::aborted ( ) const
noexcept

◆ block()

void neolib::thread::block ( )

◆ blocked()

bool neolib::thread::blocked ( ) const
noexcept

◆ cancel()

void neolib::thread::cancel ( )

◆ cancelled()

bool neolib::thread::cancelled ( ) const
noexcept

◆ elapsed_ms()

static uint64_t neolib::thread::elapsed_ms ( )
staticnoexcept

◆ elapsed_ns()

static uint64_t neolib::thread::elapsed_ns ( )
staticnoexcept

◆ elapsed_us()

static uint64_t neolib::thread::elapsed_us ( )
staticnoexcept

◆ error()

bool neolib::thread::error ( ) const
noexcept

◆ finished()

bool neolib::thread::finished ( ) const
overridevirtualnoexcept

Implements neolib::i_thread.

◆ has_thread_object()

bool neolib::thread::has_thread_object ( ) const
noexcept

◆ id()

id_type neolib::thread::id ( ) const
noexcept

◆ in()

bool neolib::thread::in ( ) const

◆ msg_wait() [1/2]

bool neolib::thread::msg_wait ( const i_message_queue aMessageQueue) const

◆ msg_wait() [2/2]

wait_result neolib::thread::msg_wait ( const i_message_queue aMessageQueue,
const waitable_event_list aEventList 
) const

◆ name()

const std::string & neolib::thread::name ( ) const
overridevirtualnoexcept

Implements neolib::i_thread.

◆ program_elapsed_ms()

static uint64_t neolib::thread::program_elapsed_ms ( )
staticnoexcept

◆ program_elapsed_ns()

static uint64_t neolib::thread::program_elapsed_ns ( )
staticnoexcept

◆ program_elapsed_us()

static uint64_t neolib::thread::program_elapsed_us ( )
staticnoexcept

◆ running()

bool neolib::thread::running ( ) const
noexcept

◆ sleep()

static void neolib::thread::sleep ( const std::chrono::duration< double, std::milli > &  aDuration)
static

◆ start()

void neolib::thread::start ( )

◆ started()

bool neolib::thread::started ( ) const
noexcept

◆ state()

thread_state neolib::thread::state ( ) const
overridevirtualnoexcept

Implements neolib::i_thread.

◆ thread_object()

thread_object_type & neolib::thread::thread_object ( ) const

◆ unblock()

void neolib::thread::unblock ( )

◆ using_existing_thread()

bool neolib::thread::using_existing_thread ( ) const
noexcept

◆ wait() [1/2]

void neolib::thread::wait ( ) const

◆ wait() [2/2]

wait_result neolib::thread::wait ( const waitable_event_list aEventList) const

◆ yield()

static void neolib::thread::yield ( )
static

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