std::recursive_mutex
Материал из 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. |
| Заголовочный файл <mutex>
|
||
| class recursive_mutex; |
(начиная с C++11) | |
recursive_mutex класс примитив синхронизации, которые могут быть использованы для защиты общих данных от одновременного доступа нескольких потоков.Original:
The
recursive_mutex class is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads.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.
recursive_mutex предлагает эксклюзивные, рекурсивные семантику владенияOriginal:
recursive_mutex offers exclusive, recursive ownership semantics: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.
- Вызывающий поток' владеет
recursive_mutexза определенный период времени, который начинается, когда он успешно вызывает либоlockилиtry_lock. В течение этого периода, нить может сделать дополнительные вызовыlockилиtry_lock. Период владения заканчивается, когда поток делает соответствующую количество обращений кunlock.Original:A calling thread owns arecursive_mutexfor a period of time that starts when it successfully calls eitherlockortry_lock. During this period, the thread may make additional calls tolockortry_lock. The period of ownership ends when the thread makes a matching number of calls tounlock.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Когда поток владеет
recursive_mutex, все остальные потоки будут блокировать (для звонков вlock) или получать значение false возвращение (дляtry_lock), если они пытаются претендовать на владениеrecursive_mutex.Original:When a thread owns arecursive_mutex, all other threads will block (for calls tolock) or receive a false return value (fortry_lock) if they attempt to claim ownership of therecursive_mutex.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Максимальное количество раз, что
recursive_mutexможет быть заблокирован не определен, но после этого число будет достигнуто, призывы кlockбудет бросать std::system_error и призываетtry_lockвернется false.Original:The maximum number of times that arecursive_mutexmay be locked is unspecified, but after that number is reached, calls tolockwill throw std::system_error and calls totry_lockwill return false.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Поведение программы не определено, если
recursive_mutex разрушен в то время как до сих пор принадлежит какую-нить. recursive_mutex класс не является копируемой.Original:
The behavior of a program is undefined if a
recursive_mutex is destroyed while still owned by some thread. The recursive_mutex class is non-copyable.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: Member type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
native_handle_type
|
Определяется реализацией
Original: implementation-defined The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[править] Член функций
| создаёт мьютекс Original: constructs the mutex The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |
Original: Locking The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| блокирует мьютекс, выполнение останавливается если мьютекс не доступен (public функция-член) | |
| пытается заблокировать мьютекс, возвращается, если мьютекс не доступен (public функция-член) | |
| разблокирует мьютекс (public функция-член) | |
Original: Native handle The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| возвращает определяемый реализацией дескриптор потока (public функция-член) | |