基于C++ Coroutines提案 ‘Stackless Resumable Functions’编写的协程库
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.

benchmark_async_mem.cpp 414B

1234567891011121314151617181920212223242526
  1. 
  2. #include <chrono>
  3. #include <iostream>
  4. #include <string>
  5. #include <conio.h>
  6. #include <thread>
  7. #include "librf.h"
  8. const size_t N = 1000000;
  9. void resumable_main_benchmark_mem()
  10. {
  11. using namespace std::chrono;
  12. for (size_t i = 0; i < N; ++i)
  13. {
  14. GO
  15. {
  16. for(size_t k = 0; k<100; ++k)
  17. co_await resumef::sleep_for(10s);
  18. };
  19. }
  20. resumef::this_scheduler()->run_until_notask();
  21. }