Small tests i share because why not
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

17 行
292 B

  1. #include <thread>
  2. #include <iostream>
  3. volatile int counter=0;
  4. void incr(const int count=200000)
  5. {
  6. for(int i=0;i<count;i++)
  7. counter++;
  8. }
  9. int main()
  10. {
  11. std::thread m(incr,200000);
  12. incr(200000);
  13. std::cout << "Expects 400000, get "<< counter <<std::endl;
  14. return 0;
  15. }