std::timed_mutex::try_lock_until
提供:cppreference.com
< cpp | thread | timed mutex
|
|
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. |
| template< class Clock, class Duration > bool try_lock_until( const std::chrono::time_point<Clock,Duration>& timeout_time ); |
(C + + 11以来) | |
mutexをロックしようとします。指定
timeout_timeまでブロックは到達しているか、ロックが獲得され、いずれか早い方。 true成功したロック取得のリターンで、そうでなければfalseを返します。 timeout_timeに達するまでより長くブロックすることがあります.Original:
Tries to lock the mutex. Blocks until specified
timeout_time has been reached or the lock is acquired, whichever comes first. On successful lock acquisition returns true, otherwise returns false. May block for longer than until timeout_time 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.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
| timeout_time | - | 最大時点はまでブロックします
Original: maximum time point to block until The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
trueロックが取得された場合は成功し、そうでなければfalse.
Original:
true if the lock was acquired successfully, otherwise false.
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.
[編集] 例外
| This section is incomplete |
[編集] 例
この例では、2つ分のブロックを示しています
Original:
This example shows a two minute block
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.
#include <iostream> #include <ctime> #include <chrono> #include <mutex> int main() { std::timed_mutex test; test.try_lock(); auto now=std::chrono::steady_clock::now(); test.try_lock_until(now+std::chrono::minutes(2)); std::cout << "hello world"; }
[編集] も参照してください
| ミューテックスは、ミューテックスが使用できない場合はブロックし、ロックします Original: locks the mutex, blocks if the mutex is not available The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| ミューテックスが使用できない場合は戻りますが、mutexをロックしようとします Original: tries to lock the mutex, returns if the mutex is not available The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |
| ミューテックスは、指定されたタイムアウト期間のbeen unavailable持っている場合、返品をmutexをロックしようとします Original: tries to lock the mutex, returns if the mutex has been unavailable for 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. (パブリックメンバ関数) | |
| ミューテックスのロックを解除します Original: unlocks the mutex The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (パブリックメンバ関数) | |