std::condition_variable_any
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <condition_variable>
|
||
| class condition_variable_any; |
(начиная с C++11) | |
condition_variable_any класса является обобщением std::condition_variable. В то время как std::condition_variable работает только на std::unique_lock<std::mutex>, condition_variable_any может работать на любой пользовательской блокировки, которая отвечает требованиям BasicLockable.Original:
The
condition_variable_any class is a generalization of std::condition_variable. Whereas std::condition_variable works only on std::unique_lock<std::mutex>, condition_variable_any can operate on any user-defined lock that meets the BasicLockable requirements.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
condition_variable_any предоставляет аналогичные функциональные возможности std::condition_variable. Это примитив синхронизации, которые могут быть использованы, чтобы блокировать некоторые числа потоков до:Original:
condition_variable_any provides similar functionality to std::condition_variable. It is a synchronization primitive that can be used to block some number of threads until:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- получения уведомления от другого потокаOriginal:a notification is received from another threadThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - тайм-аута, илиOriginal:a timeout expires, orThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - ложные пробуждения происходитOriginal:a ложные пробуждения occursThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Любой поток, который намерен ждать на
std::condition_variable_any должен получить блокировку в первую очередь. Ожидание операции атомарно освободить блокировку и приостановить выполнение потока. Когда переменная условия уведомления, поток пробуждается, и блокировка приобрело.Original:
Any thread that intends to wait on
std::condition_variable_any has to acquire a lock first. The wait operations atomically release the lock and suspend the execution of the thread. When the condition variable is notified, the thread is awakened, and the lock is reacquired.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Класс
std::condition_variable_any является стандартным макетом класса. Это не копия, конструктивных, перемещение конструктивных, скопируйте переуступке, или перемещение назначаемые.Original:
The class
std::condition_variable_any is a standard-layout class. It is not copy-constructible, move-constructible, copy-assignable, or move-assignable.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Если блокировка std::unique_lock, std::condition_variable может обеспечить более высокую производительность.
Original:
If the lock is std::unique_lock, std::condition_variable may provide better performance.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Член функций
| Строит объект Original: constructs the object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
| разрушает объект Original: destructs the object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
| operator= [удалено] |
Не копия переуступке Original: not copy-assignable The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) |
Original: Notification The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| уведомляет один ожидающий поток Original: notifies one waiting thread The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
| уведомляет всех ожидающих потоков Original: notifies all waiting threads The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
Original: Waiting The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| блокирует текущий поток до тех пор пока переменная условия проснулся Original: blocks the current thread until the condition variable is woken up The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
| блокирует текущий поток до тех пор пока переменная условия проснулась или после указанного периода тайм-аута Original: blocks the current thread until the condition variable is woken up or after the specified timeout duration The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
| блокирует текущий поток до тех пор пока переменная условия проснулся или до указанного момента времени была достигнута Original: blocks the current thread until the condition variable is woken up or until specified time point has been reached The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |