windows_critical_section.cpp 566 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include<__vic/windows/critical_section.h>
  2. #include<iostream>
  3. #include<exception>
  4. #include<cassert>
  5. void native_test()
  6. {
  7. CRITICAL_SECTION cs;
  8. ::InitializeCriticalSection(&cs);
  9. __vic::windows::CSGuard guard(cs);
  10. }
  11. void wrapper_test()
  12. {
  13. __vic::windows::CriticalSection cs;
  14. __vic::windows::CSGuard guard(cs);
  15. }
  16. void run_tests()
  17. {
  18. native_test();
  19. wrapper_test();
  20. }
  21. int main()
  22. {
  23. try
  24. {
  25. run_tests();
  26. return 0;
  27. }
  28. catch(const std::exception &ex)
  29. {
  30. std::cerr << ex.what() << '\n';
  31. }
  32. return 1;
  33. }