25#ifndef JOIN_CORE_THREAD_HPP
26#define JOIN_CORE_THREAD_HPP
29#include <system_error>
56 template <
class Function,
class... Args>
69 template <
class Function,
class... Args>
76 pthread_create (&_handle,
nullptr, _routine,
this);
117 static void* _routine (
void* context);
126 std::function<void ()> _func;
138 std::atomic_bool _done;
160 template <class
Function, class... Args>
173 template <
class Function,
class... Args>
262 bool running () const noexcept;
267 void join () noexcept;
290 pthread_t
handle () const noexcept;
fixed-capacity move-only allocation-free alternative to std::function.
Definition function.hpp:43
thread invoker class.
Definition thread.hpp:43
Invoker()=delete
default constructor.
~Invoker()=default
destoyer.
Invoker(const Invoker &other)=delete
copy constructor.
Invoker & operator=(const Invoker &other)=delete
copy assignment.
Invoker(Invoker &&other)=delete
move constructor.
thread class.
Definition thread.hpp:148
int priority() const noexcept
get current thread priority.
Definition thread.cpp:225
int affinity() const noexcept
get current thread affinity.
Definition thread.cpp:160
~Thread()
destroys the thread object.
Definition thread.cpp:97
bool tryJoin() noexcept
performs a nonblocking join on the running thread.
Definition thread.cpp:265
Thread() noexcept=default
default constructor.
Thread(int core, int prio, Function &&func, Args &&... args)
creates a new thread object associated with a thread of execution.
Definition thread.hpp:174
Thread(const Thread &other)=delete
copy constructor.
void swap(Thread &other) noexcept
swap underlying handles of two thread objects.
Definition thread.cpp:292
void cancel() noexcept
cancel the running thread if any.
Definition thread.cpp:279
Thread & operator=(const Thread &other)=delete
copy assignment.
bool joinable() const noexcept
check if thread is joinable.
Definition thread.cpp:234
pthread_t handle() const noexcept
get the handle of the thread of execution. @retunr thread of execution handle.
Definition thread.cpp:301
bool running() const noexcept
check if the thread is running.
Definition thread.cpp:243
Definition acceptor.hpp:32