The Thread wrapper.
More...
#include <thread.h>
|
| bool | run () noexcept |
| | Creates a new thread.
|
| |
| bool | run (Flags< Options > opts, std::size_t stack={}) noexcept |
| | Creates a new thread.
|
| |
| bool | join () noexcept |
| | Joins with a terminated thread.
|
| |
| Loop & | loop () const noexcept |
| | Gets the loop from which the resource was originated.
|
| |
| const uv_thread_t * | raw () const noexcept |
| | Gets the underlying raw data structure.
|
| |
| uv_thread_t * | raw () noexcept |
| | Gets the underlying raw data structure.
|
| |
|
| static Type | self () noexcept |
| | Obtains the identifier of the calling thread.
|
| |
| static bool | equal (const Thread &tl, const Thread &tr) noexcept |
| | Compares thread by means of their identifiers.
|
| |
| static std::shared_ptr< Thread > | create (Args &&...args) |
| | Creates a new resource of the given type.
|
| |
The Thread wrapper.
To create a Thread through a Loop, arguments follow:
- A callback invoked to initialize thread execution. The type must be such that it can be assigned to an
std::function<void(std::shared_ptr<void>)>.
- An optional payload the type of which is
std::shared_ptr<void>.
Definition at line 43 of file thread.h.
◆ equal()
| static bool uvw::Thread::equal |
( |
const Thread & | tl, |
|
|
const Thread & | tr ) |
|
staticnoexcept |
Compares thread by means of their identifiers.
- Parameters
-
| tl | A valid instance of a thread. |
| tr | A valid instance of a thread. |
- Returns
- True if the two threads are the same thread, false otherwise.
◆ join()
| bool uvw::Thread::join |
( |
| ) |
|
|
noexcept |
Joins with a terminated thread.
- Returns
- True in case of success, false otherwise.
◆ run() [1/2]
| bool uvw::Thread::run |
( |
| ) |
|
|
noexcept |
Creates a new thread.
- Returns
- True in case of success, false otherwise.
◆ run() [2/2]
| bool uvw::Thread::run |
( |
Flags< Options > | opts, |
|
|
std::size_t | stack = {} ) |
|
noexcept |
Creates a new thread.
Available flags are:
Thread::Options::THREAD_NO_FLAGS: no flags set.
Thread::Options::THREAD_HAS_STACK_SIZE: if set, stack specifies a stack size for the new thread. 0 indicates that the default value should be used (it behaves as if the flag was not set). Other values will be rounded up to the nearest page boundary.
- Returns
- True in case of success, false otherwise.
◆ self()
| static Type uvw::Thread::self |
( |
| ) |
|
|
staticnoexcept |
Obtains the identifier of the calling thread.
- Returns
- The identifier of the calling thread.
The documentation for this class was generated from the following file: