The Wayback Machine - https://web.archive.org/web/20180223001758/http://ja.cppreference.com:80/w/cpp/thread
名前空間
変種
操作

Thread support library

提供: cppreference.com
< cpp

C++には組み込みのスレッド、排他制御、条件変数、先物(future)サポートがあります。

目次

[編集]スレッド

スレッドによりプログラムを複数のCPUコアで実行することができます。

Defined in header <thread>
(C++11)
別のスレッドを管理します
(クラス)[edit]
Functions managing the current thread
Defined in namespace this_thread
(C++11)
コンパイラにスレッドの切り替えができるというヒントを与えます
(関数)[edit]
(C++11)
現在のスレッドのスレッドIDを返します
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]

[編集]相互排除

相互排除アルゴリズムにより複数のスレッドが共有リソースに同時にアクセスすることを防ぐことができます。これによりデータ競合を避け、スレッド間の同期を実現できます。

Defined in header <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]
汎用Mutex管理
厳密にスコープに基づくミューテックスの所有権のラッパーを実装します
(クラステンプレート)[edit]
notes=(C++11)}}
可動ミューテックスの所有権のラッパーを実装します
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]

[編集]条件変数

条件変数は複数のスレッド間のコミュニケーションを可能にする同期プリミティブです。いくつかのスレッドが別のスレッドからの通知を待って(もしくは一定のタイムアウトの後に)実行を再開することが可能となります。条件変数は常にmutexと紐付けられます。

Defined in header <condition_variable>
std::unique_lockと紐付いた条件変数を提供します
(クラス)
一般のロック型と紐付いた条件変数を提供します
(クラス)
現在のスレッドが完全に終了したのちにnotify_allが呼ばれるようにスケジュールします
(関数)
(C++11)
条件変数をタイムアウトつきでウェイトしたときのありうる結果を列挙します
(列挙)

[編集]先物(future)

標準ライブラリは非同期タスク(別々のスレッドから呼ばれた関数)から値もしくは例外を取得するための機能を提供します。値は「共有状態」を介してやりとりされます。「共有状態」には非同期タスクが値もしくは例外を格納でき、検証したり、ウェイトすることができ、その共有状態に紐付いたstd::futureもしくはstd::shared_futureのインスタンスを持つスレッドから操作されたりします。

Defined in header <先物(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::futurestd::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)エラー
先物又は約束に関連したエラーを報告します
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]
close