Contains threading definitions.
Topics | |
| tasks | |
| Contains tasks definitions. | |
Classes | |
| class | xtd::threading::auto_reset_event |
| Represents a thread synchronization event that, when signaled, resets automatically after releasing a single waiting thread. This class cannot be inherited. More... | |
| class | xtd::threading::barrier |
| Enables multiple tasks to cooperatively work on an algorithm in parallel through multiple phases. More... | |
| class | xtd::threading::cancellation_token |
| Propagates notification that operations should be canceled. More... | |
| class | xtd::threading::cancellation_token_registration |
| Propagates notification that operations should be canceled. More... | |
| class | xtd::threading::cancellation_token_source |
| Signals to a xtd::threading::cancellation_token that it should be canceled. More... | |
| class | xtd::threading::countdown_event |
| Represents a synchronization primitive that is signaled when its count reaches zero. More... | |
| class | xtd::threading::event_wait_handle |
| Represents a thread synchronization event. More... | |
| class | xtd::threading::interlocked |
| Provides atomic operations for variables that are shared by multiple threads. More... | |
| class | xtd::threading::jthread |
| Creates and controls an automatically rejoins on destruction thread, sets its priority, and gets its status. More... | |
| class | xtd::threading::lock |
| Provides a mechanism that synchronizes access to objects with xtd::threading::monitor. More... | |
| class | xtd::threading::lock_guard |
| Provides a mechanism that synchronizes access to objects with xtd::threading::mutex. More... | |
| class | xtd::threading::manual_reset_event |
| Represents a thread synchronization event that, when signaled, must be reset manually. This class cannot be inherited. More... | |
| class | xtd::threading::monitor |
| Provides a mechanism that synchronizes access to objects. More... | |
| class | xtd::threading::mutex |
| A synchronization primitive that can also be used for interprocess synchronization. More... | |
| class | xtd::threading::registered_wait_handle |
| A synchronization primitive that can also be used for interprocess synchronization. More... | |
| class | xtd::threading::semaphore |
| Limits the number of threads that can access a resource or pool of resources concurrently. More... | |
| class | xtd::threading::spin_lock |
| Provides a mutual exclusion lock primitive where a thread trying to acquire the lock waits in a loop repeatedly checking until the lock becomes available. More... | |
| class | xtd::threading::thread |
| Creates and controls a thread, sets its priority, and gets its status. More... | |
| class | xtd::threading::thread_local_object< value_t > |
| Provides thread-local storage of data. More... | |
| class | xtd::threading::thread_pool |
| Provides a pool of threads that can be used to execute tasks, post work items, process asynchronous I/O, wait on behalf of other threads, and process timers. More... | |
| class | xtd::threading::timeout |
| Contains a constant used to specify an infinite amount of time. This class cannot be inherited. More... | |
| class | xtd::threading::timer |
| Provides a mechanism for executing a method on a thread pool thread at specified intervals. This class cannot be inherited. More... | |
| class | xtd::threading::wait_handle |
| Encapsulates operating system specific objects that wait for exclusive access to shared resources. More... | |
Public Static Properties | |
| xtd::intptr | xtd::threading::this_thread::handle () noexcept |
| Gets the thread handle of the current thread. | |
| xtd::int32 | xtd::threading::this_thread::managed_thread_id () noexcept |
| Gets the managed thread id of the current thread. | |
| xtd::string | xtd::threading::this_thread::name () noexcept |
| Gets the thread name of the current thread. | |
| void | xtd::threading::this_thread::name (const xtd::string &name) |
| Sets the thread name of the current thread. | |
| xtd::threading::thread_priority | xtd::threading::this_thread::priority () noexcept |
| Gets the thread priority of the current thread. | |
| void | xtd::threading::this_thread::priority (xtd::threading::thread_priority priority) |
| Sets the thread priority of the current thread. | |
| xtd::intptr | xtd::threading::this_thread::thread_id () noexcept |
| Gets the thread id of the current thread. | |
Public Static Methods | |
| xtd::intptr | xtd::threading::this_thread::get_id () noexcept |
| Returns the thread id of the current thread. | |
| void | xtd::threading::this_thread::sleep_for (const xtd::time_span &sleep_duration) |
| Stops the execution of the current thread for a specified time duration. | |
| void | xtd::threading::this_thread::sleep_until (const xtd::date_time &sleep_time) |
| Stops the execution of the current thread until a specified time point. | |
| bool | xtd::threading::this_thread::yield () noexcept |
| Suggests that the implementation reschedule execution of threads. | |
|
strong |
#include <xtd.core/include/xtd/threading/event_reset_mode.hpp>
Indicates whether an xtd::threading::event_wait_handle is reset automatically or manually after receiving a signal.
| Enumerator | |
|---|---|
| auto_reset | When signaled, the xtd::threading::event_wait_handle resets automatically after releasing a single thread. If no threads are waiting, the xtd::threading::event_wait_handle remains signaled until a thread blocks, and resets after releasing the thread. |
| manual_reset | When signaled, the xtd::threading::event_wait_handle releases all waiting threads and remains signaled until it is manually reset. |
|
strong |
#include <xtd.core/include/xtd/threading/thread_priority.hpp>
Specifies the scheduling priority of a system::threading::thread.
| Enumerator | |
|---|---|
| lowest | The system::threading::thread can be scheduled after threads with any other priority. |
| below_normal | The system::threading::thread can be scheduled after threads with thread_priority::normal priority and before those with thread_priority::lowest priority. |
| normal | The system::threading::thread can be scheduled after threads with thread_priority::above_normal priority and before those with thread_priority::below_normal priority. Threads have thread_priority::normal priority by default. |
| above_normal | The system::threading::thread can be scheduled after threads with thread_priority::highest priority and before those with thread_priority::normal priority. |
| highest | The system::threading::thread can be scheduled before threads with any other priority. |
|
strong |
#include <xtd.core/include/xtd/threading/thread_state.hpp>
Specifies the execution states of a System::Threading::Thread.
| Enumerator | |
|---|---|
| running | The thread_state has been started, it is not blocked, and there is no pending System::Threading::ThreadAbortException. |
| stop_requested | The thread_state is being requested to stop. This is for internal use only. |
| suspend_requested | The thread_state is being requested to suspend. |
| background | The thread_state is being executed as a background thread_state, as opposed to a foreground thread_state. This state is controlled by setting the System::Threading::Thread.Isbackground property. |
| unstarted | The System::Threading::Thread.Start() method has not been invoked on the thread_state. |
| stopped | The thread_state has stopped. |
| wait_sleep_join | The thread_state is blocked. This could be the result of calling System::Threading::Thread.Sleep(System::Int32) or System::Threading::Thread.Join(), of requesting a lock � for example, by calling System::Threading::Monitor.Enter(System::object) or System::Threading::Monitor.Wait(System::object,System::Int32,System::Boolean) or of waiting on a thread_state synchronization object such as System::Threading::ManualResetEvent. |
| suspended | The thread_state has been suspended. |
| abort_requested | The System::Threading::Thread.Abort(System::object) method has been invoked on the thread_state, but the thread_state has not yet received the pending System::Threading::ThreadAbortException that will attempt to terminate it. |
| aborted | The thread_state state includes System::Threading::ThreadState.abort_requested and the thread_state is now dead, but its state has not yet changed to System::Threading::ThreadState.stopped. |
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Gets the thread handle of the current thread.
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Gets the managed thread id of the current thread.
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Gets the thread name of the current thread.
| void xtd::threading::this_thread::name | ( | const xtd::string & | name | ) |
#include <xtd.core/include/xtd/threading/thread.hpp>
Sets the thread name of the current thread.
| name | The thread name of the current thread. |
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Gets the thread priority of the current thread.
| void xtd::threading::this_thread::priority | ( | xtd::threading::thread_priority | priority | ) |
#include <xtd.core/include/xtd/threading/thread.hpp>
Sets the thread priority of the current thread.
| priority | The thread priority of the current thread. |
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Gets the thread id of the current thread.
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Returns the thread id of the current thread.
| void xtd::threading::this_thread::sleep_for | ( | const xtd::time_span & | sleep_duration | ) |
#include <xtd.core/include/xtd/threading/thread.hpp>
Stops the execution of the current thread for a specified time duration.
| sleep_duration | The time duration to sleep. |
sleep_duration. | void xtd::threading::this_thread::sleep_until | ( | const xtd::date_time & | sleep_time | ) |
#include <xtd.core/include/xtd/threading/thread.hpp>
Stops the execution of the current thread until a specified time point.
| sleep_time | The time to block until. |
sleep_time has been reached.
|
noexcept |
#include <xtd.core/include/xtd/threading/thread.hpp>
Suggests that the implementation reschedule execution of threads.
true if the operating system switched execution to another thread; otherwise, false.