xtd 0.2.0
Loading...
Searching...
No Matches

Definition

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...
 

Enumerations

enum class  xtd::threading::event_reset_mode {
  xtd::threading::event_reset_mode::auto_reset ,
  xtd::threading::event_reset_mode::manual_reset
}
 Indicates whether an xtd::threading::event_wait_handle is reset automatically or manually after receiving a signal. More...
 
enum class  xtd::threading::thread_priority {
  xtd::threading::thread_priority::lowest ,
  xtd::threading::thread_priority::below_normal ,
  xtd::threading::thread_priority::normal ,
  xtd::threading::thread_priority::above_normal ,
  xtd::threading::thread_priority::highest
}
 Specifies the scheduling priority of a system::threading::thread. More...
 
enum class  xtd::threading::thread_state {
  xtd::threading::thread_state::running ,
  xtd::threading::thread_state::stop_requested ,
  xtd::threading::thread_state::suspend_requested ,
  xtd::threading::thread_state::background ,
  xtd::threading::thread_state::unstarted ,
  xtd::threading::thread_state::stopped ,
  xtd::threading::thread_state::wait_sleep_join ,
  xtd::threading::thread_state::suspended ,
  xtd::threading::thread_state::abort_requested ,
  xtd::threading::thread_state::aborted
}
 Specifies the execution states of a System::Threading::Thread. 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.
 

Enumeration Type Documentation

◆ event_reset_mode

#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.

enum class event_reset_mode
event_reset_mode
Indicates whether an xtd::threading::event_wait_handle is reset automatically or manually after recei...
Definition event_reset_mode.hpp:24
Header
#include <xtd/threading/event_reset_mode>
Namespace
xtd::threading
Library
xtd.core
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.

◆ thread_priority

#include <xtd.core/include/xtd/threading/thread_priority.hpp>

Specifies the scheduling priority of a system::threading::thread.

enum class thread_priority
thread_priority
Specifies the scheduling priority of a system::threading::thread.
Definition thread_priority.hpp:24
Header
#include <xtd/threading/thread_priority>
Namespace
xtd::threading
Library
xtd.core
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.

◆ thread_state

enum class xtd::threading::thread_state
strong

#include <xtd.core/include/xtd/threading/thread_state.hpp>

Specifies the execution states of a System::Threading::Thread.

enum class thread_state
thread_state
Specifies the execution states of a System::Threading::Thread.
Definition thread_state.hpp:24
Header
#include <xtd/threading/thread_state>
Namespace
xtd::threading
Library
xtd.core
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.

Function Documentation

◆ handle()

xtd::intptr xtd::threading::this_thread::handle ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Gets the thread handle of the current thread.

Returns
The thread handle of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ managed_thread_id()

xtd::int32 xtd::threading::this_thread::managed_thread_id ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Gets the managed thread id of the current thread.

Returns
The managed thread id of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ name() [1/2]

xtd::string xtd::threading::this_thread::name ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Gets the thread name of the current thread.

Returns
The thread name of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ name() [2/2]

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.

Parameters
nameThe thread name of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ priority() [1/2]

xtd::threading::thread_priority xtd::threading::this_thread::priority ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Gets the thread priority of the current thread.

Returns
The thread priority of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ priority() [2/2]

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.

Parameters
priorityThe thread priority of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ thread_id()

xtd::intptr xtd::threading::this_thread::thread_id ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Gets the thread id of the current thread.

Returns
The thread id of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ get_id()

xtd::intptr xtd::threading::this_thread::get_id ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Returns the thread id of the current thread.

Returns
The thread id of the current thread.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ sleep_for()

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.

Parameters
sleep_durationThe time duration to sleep.
Remarks
Blocks the execution of the current thread for at least the specified sleep_duration.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ sleep_until()

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.

Parameters
sleep_timeThe time to block until.
Remarks
Blocks the execution of the current thread until specified sleep_time has been reached.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core

◆ yield()

bool xtd::threading::this_thread::yield ( )
noexcept

#include <xtd.core/include/xtd/threading/thread.hpp>

Suggests that the implementation reschedule execution of threads.

Returns
true if the operating system switched execution to another thread; otherwise, false.
Header
#include <xtd/threading/thread>
Namespace
xtd
Library
xtd.core