
エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
C++11:スレッド・ライブラリひとめぐり【補足編:2】
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
C++11:スレッド・ライブラリひとめぐり【補足編:2】
#include <iostream> #include <thread> #include <functional> #include <chrono> #include <mutex> //... #include <iostream> #include <thread> #include <functional> #include <chrono> #include <mutex> // data-race が発生するハダカの足し算 void add(long* address, long value) { *address += value; } void run(std::function<void(long*, long)> fun, long* address) { using namespace std; using namespace std::chrono; auto task = [=](int n, long v) { while ( n-- ) fun(address, v); }; const int N = 100000; thread threads[4]