C ++ 11 Thread support library Overview

Source: Internet
Author: User

1 Threads thread 1.1 Functions managing the current thread manages the current thread function 2 Mutual exclusion mutex 2.1 Generic mutex management universal mutex management 2.2 Generic locking algorithms universal lock algorithm 2.3 Call once single Call 3 Condition variables Condition variable 4 Futures future ThreadsThreads enable the program to execute into SS several processor cores. // The thread enables the program to run across multiple cores (cores. Defined in header <thread> // Defined in the <thread> header file thread (C ++ 11) manages a separate thread // manages an independent thread (class) functions managing the current thread // function for managing the current thread Defined in namespace this_thread // Defined in the namespace domain this_thread yield (C ++ 11) hints the implementation to reschedule execution of threads (function) // prompt to reschedule thread execution, that is, calling yield will reduce the priority. Get_id (C ++ 11) returns the thread id of the current thread (function) // the return thread id sleep_for (C ++ 11) stops the execution of the current thread for a specified time duration (function) // stop the current thread for a period of time sleep_until (C ++ 11) stops the execution of the current thread until a specified time point (function) // stop the current thread until a certain time point Mutual exclusion // mutex Mutual exclusion algorithms restrict access to a shared resource so that onl Y one thread can access it at a time. this allows to avoid data races and to implement synchronization between threads. // The mutex limit allows only one thread to access the shared resource at a certain time. This avoids resource competition and achieves synchronization between threads. Defined in header <mutex> // Defined in the <mutex> header file mutex (C ++ 11) provides basic mutual exclusion facility (class) // provide the basic mutex timed_mutex (C ++ 11) provides mutual exclusion facility which implements locking with a timeout (class) // provide the timeout mutex (unlock upon timeout) recursive_mutex (C ++ 11) provides mutual exclusion facility which can be locked recursively by the same thread (class) // provide the mutex recursive_timed_mutex (C ++ 11) provides mu that can be recursively locked by the same thread Tual exclusion facility which can be locked recursivelyby the same thread and implements locking with a timeout (class) // provides a mutex that can be recursively locked by the same thread and has timed out. (Supermarket unlock) Generic mutex management // General mutex management lock_guard (C ++ 11) implements strictly scope-based mutex ownership wrapper (class template) // encapsulation based on strict scope mutex (unlock automatically upon exit of scope) unique_lock (C ++ 11) implements movable mutex ownership wrapper (class template) // removable mutex encapsulation (exclusive lock, which can be set to time-out) define type used to specify locking strategy (class) // defines the type of the specified lock policy defer_locktry_to_lockadopt_locktag constant S used to specify locking strategy (constant) // constant Generic locking algorithms // General lock algorithm try_lock (C ++ 11) locks specified mutexes/locks, returns false if at least one is unavailable (function template) // lock the specified mutex/lock. if no row is available, false lock (C ++ 11) is returned) locks specified mutexes/locks, blocks if at least one is unavailable (function template) // lock the specified mutex/lock. if one lock fails, it will be blocked. Call once // Call once_flag (C ++ 11) helper object to ensure that call_once invokes the function only once (class) // The help object ensures that it only calls the function once call_once (C ++ 11) invokes a function only once even if called from multiple threads (function template) // only the conditional function Condition variables can be called even if multiple threads are called. // The Conditional variable A condition variable is a synchronization primitive which implements a list of threads that are waiting until another thread notifi Es one or all of the waiting threads that they may proceed, until a timeout expires, or until a spurous wakeup occurs. A condition variable is always associated with a mutex. // a condition variable is a synchronization primitive that implements a list of threads waiting for another thread to notify one or all of the waiting threads. They may continue until a timeout expires, or until a false wake-up occurs. A condition variable is always associated with a mutex. Condition_variable (C ++ 11) provides a condition variable assocaited with std: unique_lock (class) // provides a condition variable condition_variable_any (C ++ 11) associated with std: unique_lock) provides a condition varibale associated with any lock type (class) // provides a condition variable notify_all_at_thread_exit (C ++ 11) associated with any lock type) schedules a call to policy_all to be invoked when this thread exits (function) // call a scheduling (call) when the thread exits to notify all cv_status (C ++ 11) lists the possible results of timed waits on condition variables (class) // lists the possible results of the timed wait condition variable Futures // future This section is incomplete // This section is unfinished Defined in header <future> // in the header file <future> define promise (C ++ 11) stores a value for asynchronous retrieval (class template) // store the asynchronous return value packaged_task (C ++ 11) packages a function to store its return value for asynchronous retrieval (class template) // package a function for the asynchronous return value to store its return value future (C ++ 11) waits for a value that is set asynchronously (class template) // wait for an asynchronous value shared_future (C ++ 11) waits for a value that is set asynchronously. the internal state is shared among several objects (class template) // wait for an asynchronous value. The internal state is async (C ++ 11) shared among several objects) provides a facility to launch a function in a new thread and acquire its return value asynchronously (function template) // provides a tool to start a function and obtain its return values asynchronously in a new thread.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.