Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #include <thread>
  2. #include <iostream>
  3.  
  4. void run (int x) {
  5. std::cout<<".";
  6. }
  7.  
  8. int main (int argc, char const *argv[])
  9. {
  10. std::thread t(run);
  11. }
  12.  
  13. minimal.cpp:10:17: error: no matching constructor for initialization of 'std::thread'
  14. std::thread t(run,0);
  15. ^ ~~~~~
  16. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:372:9: note: candidate constructor template not viable: requires single argument '__f', but 2 arguments
  17. were provided
  18. thread::thread(_Fp __f)
  19. ^
  20. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:261:5: note: candidate constructor not viable: requires 1 argument, but 2 were provided
  21. thread(const thread&);
  22. ^
  23. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/thread:268:5: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
  24. thread() _NOEXCEPT : __t_(0) {}
  25. ^
  26. 1 error generated.
  27.  
  28. #if !(__has_feature(cxx_variadic_templates))
  29. #define _LIBCPP_HAS_NO_VARIADICS
  30. #endif
  31.  
  32. Xcode run:
  33.  
  34. st...ok - lap: 4875 ms
  35. st/8...ok - lap: 1205 ms
  36. mt...ok - lap: 8330 ms
  37. st/mt ratio:**0.6**
  38.  
  39. Instruments run:
  40.  
  41. st...ok - lap: 2182 ms
  42. st/8...ok - lap: 545 ms
  43. mt...ok - lap: 596 ms
  44. st/mt ratio:**3.7**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement