Пространства имён
Варианты
Действия

Библиотека поддержки потоков

Материал из cppreference.com
< cpp

 
 
Библиотека поддержки потоков
Потоки
Original:
Threads
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
thread(C++11)
this_thread имен
Original:
this_thread namespace
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get_id(C++11)
yield(C++11)
sleep_for(C++11)
sleep_until(C++11)
Взаимное исключение
Original:
Mutual exclusion
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
mutex(C++11)
timed_mutex(C++11)
Generic управления замком
Original:
Generic lock management
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
lock_guard(C++11)
unique_lock(C++11)
defer_lock_t
try_to_lock_t
adopt_lock_t
(C++11)
(C++11)
(C++11)
lock(C++11)
try_lock(C++11)
defer_lock
try_to_lock
adopt_lock
(C++11)
(C++11)
(C++11)
Условия переменных
Original:
Condition variables
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
condition_variable(C++11)
condition_variable_any(C++11)
notify_all_at_thread_exit(C++11)
cv_status(C++11)
Futures
Original:
Futures
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
promise(C++11)
future(C++11)
shared_future(C++11)
packaged_task(C++11)
async(C++11)
launch(C++11)
future_status(C++11)
future_error(C++11)
future_category(C++11)
future_errc(C++11)
 
В C++ имеется поддержка потоков, взаимных исключений (мьютексов), условных переменных и futures.
Original:
C++ includes built-in support for threads, mutual exclusion, condition variables, and futures.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Потоки

Потоки позволяют программам выполняться на нескольких ядрах процессора.

Определено в файле <thread>
(C++11)
управляет отдельный поток
Original:
manages a separate thread
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
Functions managing the current thread
Defined in namespace this_thread
(C++11)
suggests that the implementation reschedule execution of threads
(функция) [edit]
(C++11)
возвращает идентификатор потока из текущего потока
Original:
returns the thread id of the current thread
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(функция) [edit]
(C++11)
останавливает выполнение текущего потока в течение указанного периода времени
Original:
stops the execution of the current thread for a specified time duration
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(функция) [edit]
stops the execution of the current thread until a specified time point
(функция) [edit]

[править] Взаимные исключения (мьютексы)

Алгоритмы взаимных исключений предотвращают одновременный доступ нескольких потоков к разделяемым ресурсам. Это позволяет исключить гонку данных и обеспечить синхронизацию между потоками.

Определено в файле <mutex>
(C++11)
предоставляет базовые средства взаимного отчуждения
Original:
provides basic mutual exclusion facility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
обеспечивает взаимное исключение объекта, который реализует блокировки с тайм-аут
Original:
provides mutual exclusion facility which implements locking with a timeout
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
обеспечивает взаимное исключение объекта, который может быть заблокирован рекурсивно тем же потоком
Original:
provides mutual exclusion facility which can be locked recursively by the same thread
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
обеспечивает взаимное исключение объекта, который может быть заблокирован recursively
тем же потоком и инвентарь блокировки с тайм-аут
Original:
provides mutual exclusion facility which can be locked recursively
by the same thread and implements locking with a timeout
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
Основное управление мьютексами
реализует строго сферы на основе оболочки мьютекс собственности
Original:
implements a strictly scope-based mutex ownership wrapper
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
реализует подвижного мьютекс собственности обертку
Original:
implements movable mutex ownership wrapper
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
тип тега используется для указания замок стратегии
Original:
tag type used to specify locking strategy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
Тег константы используются для определения замок стратегии
Original:
tag constants used to specify locking strategy
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(константа) [edit]
Основные алгоритмы блокировки
(C++11)
Попытки получить право собственности мьютексов через неоднократные призывы к try_lock
Original:
attempts to obtain ownership of mutexes via repeated calls to try_lock
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон функции) [edit]
(C++11)
Замки указанных мьютексы, блоки, если таковые пока нет
Original:
locks specified mutexes, blocks if any are unavailable
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон функции) [edit]
Однократный вызов
(C++11)
вспомогательный объект, чтобы убедиться, что call_once вызывает функцию только один раз
Original:
helper object to ensure that call_once invokes the function only once
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
(C++11)
вызывает функцию только один раз, даже если вызывать из нескольких потоков
Original:
invokes a function only once even if called from multiple threads
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон функции) [edit]

[править] Условные переменные

A condition variable is a synchronization primitive that allows multiple threads to communicate with eachother. It allows some number of threads to wait (possibly with a timeout) for notification from another thread that they may proceed. A condition variable is always associated with a mutex.

Определено в файле <condition_variable>
provides a condition variable associated with a std::unique_lock
(класс)
provides a condition variable associated with any lock type
(класс)
schedules a call to notify_all to be invoked when this thread is completely finished
(функция)
(C++11)
lists the possible results of timed waits on condition variables
(перечисление)

[править] Futures

The standard library provides facilities to obtain values that are returned and to catch exceptions that are thrown by asynchronous tasks (i.e. functions launched in separate threads). These values are communicated in a shared state, in which the asynchronous task may write its return value or store an exception, and which may be examined, waited for, and otherwise manipulated by other threads that hold instances of std::future or std::shared_future that reference that shared state.

Определено в файле <future>
(C++11)
сохраняет значение для асинхронного поиска
Original:
stores a value for asynchronous retrieval
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
Пакеты функции для хранения возвращаемого значения для асинхронных поиска
Original:
packages a function to store its return value for asynchronous retrieval
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
(C++11)
ожидает значение, которое устанавливается в асинхронном режиме
Original:
waits for a value that is set asynchronously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
ждет значения (возможно, ссылаются другие фьючерсы), который устанавливается в асинхронном режиме
Original:
waits for a value (possibly referenced by other futures) that is set asynchronously
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон класса) [edit]
(C++11)
запускает функцию асинхронно (возможно, в новом потоке) и возвращает std::future, который будет содержать результат
Original:
runs a function asynchronously (potentially in a new thread) and returns a std::future that will hold the result
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(шаблон функции) [edit]
(C++11)
определяет запуск политику std::async
Original:
specifies the launch policy for std::async
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(перечисление) [edit]
определяет результаты своевременной ждет осуществляется на std::future и std::shared_future
Original:
specifies the results of timed waits performed on std::future and std::shared_future
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(перечисление) [edit]
Future errors
сообщает об ошибке, связанной с фьючерсами или обещания
Original:
reports an error related to futures or promises
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(класс) [edit]
определяет будущее категорию ошибки
Original:
identifies the future error category
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(функция) [edit]
определяет будущее кодов ошибок
Original:
identifies the future error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(перечисление) [edit]