Execution owned by Base.
More...
#include <StormByte/safe/thread.hxx>
|
| static unsigned | hardware_concurrency () noexcept |
| | Hint of concurrent executions.
|
| static Id | Calling () noexcept |
| | Identifier of the calling execution.
|
Execution owned by Base.
Not an alias of std::thread. The native thread is started and joined in Base. Destroying a joinable thread terminates the process, as std::thread does. A UNIX execution has an 8 MiB stack. musl's default of 128 KiB is not used. Windows keeps the system default. A Function is stored by value and invoked with Call. The creator-module release stays with the function.
◆ native_handle_type
Native handle as an integer.
Not a CRT thread type.
◆ Thread() [1/5]
| StormByte::Safe::Thread::Thread |
( |
| ) |
|
|
inlinenoexcept |
◆ Thread() [2/5]
Start callable in a Base-owned execution.
- Template Parameters
-
| Callable | Callable. Invoked in the new execution. A Function uses the other constructor. |
| Args | Argument types, decayed and stored before the execution starts. |
- Parameters
-
| callable | Entry. |
| args | Arguments. |
- Exceptions
-
◆ Thread() [3/5]
Start a void Function in a Base-owned execution.
- Template Parameters
-
| Args | Argument types. Captured before the execution starts. |
- Parameters
-
| function | Callback. Moved. Its release stays in the creator module. |
| args | Arguments passed to Call. |
- Exceptions
-
Status is not returned. A Base exception is caught in the execution.
◆ Thread() [4/5]
| StormByte::Safe::Thread::Thread |
( |
const Thread & | | ) |
|
|
delete |
◆ Thread() [5/5]
| StormByte::Safe::Thread::Thread |
( |
Thread && | other | ) |
|
|
inlinenoexcept |
Take an execution.
- Parameters
-
| other | Source. Left not joinable. |
◆ ~Thread()
| StormByte::Safe::Thread::~Thread |
( |
| ) |
|
|
inlinenoexcept |
Destroy the handle.
A joinable execution terminates the process.
◆ Calling()
| Id StormByte::Safe::Thread::Calling |
( |
| ) |
|
|
inlinestaticnoexcept |
Identifier of the calling execution.
- Returns
- Non-zero identifier.
◆ detach()
| void StormByte::Safe::Thread::detach |
( |
| ) |
|
|
inline |
Detach the execution.
- Exceptions
-
◆ get_id()
| Id StormByte::Safe::Thread::get_id |
( |
| ) |
const |
|
inlinenoexcept |
Identifier of the owned execution.
- Returns
- Zero identifier when this object is not joinable.
◆ hardware_concurrency()
| unsigned StormByte::Safe::Thread::hardware_concurrency |
( |
| ) |
|
|
inlinestaticnoexcept |
Hint of concurrent executions.
- Returns
- Zero when the hint is not available.
◆ join()
| void StormByte::Safe::Thread::join |
( |
| ) |
|
|
inline |
Wait until the execution returns.
- Exceptions
-
◆ joinable()
| bool StormByte::Safe::Thread::joinable |
( |
| ) |
const |
|
inlinenoexcept |
Whether this object owns an execution.
- Returns
- Joinable flag.
◆ native_handle()
Native handle as an integer.
- Returns
- Zero when this object is not joinable.
◆ operator=() [1/2]
| Thread & StormByte::Safe::Thread::operator= |
( |
const Thread & | | ) |
|
|
delete |
◆ operator=() [2/2]
| Thread & StormByte::Safe::Thread::operator= |
( |
Thread && | other | ) |
|
|
inlinenoexcept |
Take an execution.
A joinable destination terminates the process.
- Parameters
-
| other | Source. Left not joinable. |
- Returns
- This thread.
◆ swap()
| void StormByte::Safe::Thread::swap |
( |
Thread & | other | ) |
|
|
inlinenoexcept |
Exchange two executions.
- Parameters
-
The documentation for this class was generated from the following file: