{"author_name":"onsanai","height":"190","categories":["C/C++"],"provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/onsanai/","title":"C++\u3067std::async\u3092\u4f7f\u3063\u305f\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u51e6\u7406","blog_title":"\u7269\u7406\u306e\u99c5 Physics station by \u73fe\u5f79\u7814\u7a76\u8005","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fphst.hateblo.jp%2Fentry%2F2019%2F09%2F29%2F202353\" title=\"C++\u3067std::async\u3092\u4f7f\u3063\u305f\u30de\u30eb\u30c1\u30b9\u30ec\u30c3\u30c9\u51e6\u7406 - \u7269\u7406\u306e\u99c5 Physics station by \u73fe\u5f79\u7814\u7a76\u8005\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","published":"2019-09-29 20:23:53","description":"#include <future> #include <thread> #include <vector> #include <iostream> #include <mutex> // \u6a19\u6e96\u51fa\u529b\u306emutex std::mutex mtx_; int long_calc(int i) { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); mtx_.lock(); std::cout << \"a\" << i << std::endl; mtx_.unlock(); std::this_thread::sleep_for(s\u2026","blog_url":"https://phst.hateblo.jp/","width":"100%","url":"https://phst.hateblo.jp/entry/2019/09/29/202353","type":"rich","image_url":null,"provider_name":"Hatena Blog","version":"1.0"}