xtd 0.2.0
xtd::threading Namespace Reference

Definition

The xtd::threading namespace provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data ( xtd::threading::mutex, xtd::threading::monitor, xtd::threading::interlocked, xtd::threading::auto_reset_event, and so on), this namespace includes a xtd::threading::thread_pool class that allows you to use a pool of system-supplied threads, and a xtd::threading::timer class that executes callback methods on thread pool threads.

Namespaces

namespace  tasks
 The xtd::threading::tasks namespace provides types that simplify the work of writing concurrent and asynchronous code. The main types are xtd::threading::tasks::task which represents an asynchronous operation that can be waited on and cancelled, and xtd::threading::tasks::task <result_t>, which is a task that can return a value. The xtd::threading::tasks::task_factory class provides static methods for creating and starting tasks, and the xtd::threading::tasks::task_scheduler class provides the default thread scheduling infrastructure.
 
namespace  this_thread
 The xtd::threading::this_thread namespace contains some current thread properties and sheduling methods.
 

Classes

class  abandoned_mutex_exception
 The exception that is thrown when one thread acquires a xtd::threading::mutex object that another thread has abandoned by exiting without releasing it. More...
 
class  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  barrier
 Enables multiple tasks to cooperatively work on an algorithm in parallel through multiple phases. More...
 
class  barrier_post_phase_exception
 The exception that is thrown when the post-phase action of a xtd::threading::barrier fails. More...
 
class  cancellation_token
 Propagates notification that operations should be canceled. More...
 
class  cancellation_token_registration
 Propagates notification that operations should be canceled. More...
 
class  cancellation_token_source
 Signals to a xtd::threading::cancellation_token that it should be canceled. More...
 
class  countdown_event
 Represents a synchronization primitive that is signaled when its count reaches zero. More...
 
class  event_wait_handle
 Represents a thread synchronization event. More...
 
class  interlocked
 Provides atomic operations for variables that are shared by multiple threads. More...
 
class  jthread
 Creates and controls an automatically rejoins on destruction thread, sets its priority, and gets its status. More...
 
class  lock_guard
 Provides a mechanism that synchronizes access to objects with xtd::threading::monitor. More...
 
class  lock_recursion_exception
 The exception that is thrown when recursive entry into a lock is not compatible with the recursion policy for the lock. More...
 
class  manual_reset_event
 Represents a thread synchronization event that, when signaled, must be reset manually. This class cannot be inherited. More...
 
class  monitor
 Provides a mechanism that synchronizes access to objects. More...
 
class  mutex
 A synchronization primitive that can also be used for interprocess synchronization. More...
 
class  registered_wait_handle
 A synchronization primitive that can also be used for interprocess synchronization. More...
 
class  semaphore
 Limits the number of threads that can access a resource or pool of resources concurrently. More...
 
class  semaphore_full_exception
 The exception that is thrown when a method call is invalid for the object's current state. More...
 
class  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  synchronization_lock_exception
 The exception that is thrown when a method requires the caller to own the lock on a given Monitor, and the method is invoked by a caller that does not own that lock. More...
 
class  thread
 Creates and controls a thread, sets its priority, and gets its status. More...
 
class  thread_abort_exception
 The exception that is thrown when a method call is invalid for the object's current state. More...
 
class  thread_interrupted_exception
 The exception that is thrown when a Thread is interrupted while it is in a waiting state. More...
 
class  thread_local_object
 Provides thread-local storage of data. More...
 
class  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  thread_state_exception
 The exception that is thrown when a Thread is in an invalid ThreadState for the method call. More...
 
class  timeout
 Contains a constant used to specify an infinite amount of time. This class cannot be inherited. More...
 
class  timer
 Provides a mechanism for executing a method on a thread pool thread at specified intervals. This class cannot be inherited. More...
 
class  wait_handle
 Encapsulates operating system specific objects that wait for exclusive access to shared resources. More...
 
class  wait_handle_cannot_be_opened_exception
 The exception that is thrown when a Thread is in an invalid ThreadState for the method call. More...
 

Alias

using parameterized_thread_start = xtd::delegate< void(const xtd::any_object &obj)>
 Represents the method that executes on a xtd::threading::thread.
 
using thread_start = xtd::delegate< void()>
 Represents the method that executes on a xtd::threading::thread.
 
using timer_callback = action< const xtd::any_object & >
 Represents the method that handles calls from a xtd::threading::timer.
 
using wait_callback = xtd::delegate< void(const xtd::any_object &state)>
 Represents a callback method to be executed by a thread pool thread.
 
using wait_or_timer_callback = xtd::delegate< void(const xtd::any_object &state, bool timed_out)>
 Represents a method to be called when a xtd::threading::wait_handle is signaled or times out.
 

Enumerations

enum class  event_reset_mode {
  event_reset_mode::auto_reset ,
  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  thread_priority {
  thread_priority::lowest ,
  thread_priority::below_normal ,
  thread_priority::normal ,
  thread_priority::above_normal ,
  thread_priority::highest
}
 Specifies the scheduling priority of a system::threading::thread. More...
 
enum class  thread_state {
  thread_state::running ,
  thread_state::stop_requested ,
  thread_state::suspend_requested ,
  thread_state::background ,
  thread_state::unstarted ,
  thread_state::stopped ,
  thread_state::wait_sleep_join ,
  thread_state::suspended ,
  thread_state::abort_requested ,
  thread_state::aborted
}
 Specifies the execution states of a System::Threading::Thread. More...