This is the reference documentation of namespace threads of the ALib C++ Framework, which holds types of library module ALib Threads.
Further documentation is provided with
Nested Namespaces: | |
| namespace | detail |
| Details of namespace alib::threads. | |
Type Index: | |
| struct | DbgConditionAsserter |
| struct | DbgLockAsserter |
| struct | DbgSharedLockAsserter |
| class | Event |
| class | Lock |
| class | Promise |
| class | RecursiveLock |
| class | RecursiveTimedLock |
| class | Runnable |
| class | SharedLock |
| class | SharedTimedLock |
| struct | TCondition |
| class | Thread |
| class | TimedLock |
Type Definition Index: | |
| using | ThreadID = integer |
| The ALib thread identifier type. | |
Function Index: | |
| void | bootstrap () |
| void | BootstrapThreadMap (integer qty) |
| void | shutdown () |
Variable Index: | |
| Lock | STD_IOSTREAMS_LOCK |
| Thread * | THIS_THREAD = nullptr |
| A thread-local pointer to the ALib representation of the actual thread. | |
| constexpr ThreadID | UNDEFINED = 0 |
| This is a value that may be passed as a value indicating an undefined thread. | |
| using alib::threads::ThreadID = integer |
The ALib thread identifier type.
Definition at line 23 of file thread.inl.
| void alib::threads::bootstrap | ( | ) |
Initializes ALib thread logic. Multiple invocations of this method are forbidden.
The standard bootstrap code of ALib, hence the (overloaded) functions Bootstrap will call this function.
Definition at line 137 of file thread.cpp.
| void alib::threads::BootstrapThreadMap | ( | integer | qty | ) |
Internally, a hash map used to find the current thread object. The map uses default values for float BaseLoadFactor() const and float MaxLoadFactor() const . Depending on the use of threads by a using application, these values might be modified before starting the first phase of bootstrapping ALib.
This namespace function allows doing this by passing the given parameters to method void Reserve(integer, lang::ValueReference) of the internal table.
std::unordered_map, which receives similar parameters.| qty | The expected number of threads. |
Definition at line 130 of file thread.cpp.
| void alib::threads::shutdown | ( | ) |
Frees resources and shuts down ALib thread logic. Multiple invocations of this method are forbidden. The standard bootstrap code of ALib, hence the (overloaded) functions Shutdown will call this function.
Definition at line 160 of file thread.cpp.
| Lock alib::threads::STD_IOSTREAMS_LOCK |
This global mutex is acquired by ALib-types, whenever data is written to either std::cout or std::cerr. This is, for example, acquired by function alib::assert::Raise and by loggers of module ALox that log to the console (see here).
The utility type OStreamWriter uses this lock as well as C++20 type std::basic_osyncstream (if available with the toolchain used) to have maximum protection in respect to writing to the console.
|
thread_local |
A thread-local pointer to the ALib representation of the actual thread.
Definition at line 215 of file thread.cpp.
|
inlineconstexpr |
This is a value that may be passed as a value indicating an undefined thread.
Definition at line 29 of file thread.inl.