Small tests i share because why not
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
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. }