基于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.

test_librf.cpp 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #include "librf/librf.h"
  2. #include <iostream>
  3. extern void resumable_main_yield_return();
  4. extern void resumable_main_timer();
  5. extern void resumable_main_suspend_always();
  6. extern void resumable_main_sleep();
  7. extern void resumable_main_routine();
  8. extern void resumable_main_resumable();
  9. extern void resumable_main_mutex();
  10. extern void resumable_main_exception();
  11. extern void resumable_main_event();
  12. extern void resumable_main_event_v2();
  13. extern void resumable_main_event_timeout();
  14. extern void resumable_main_dynamic_go();
  15. extern void resumable_main_channel();
  16. extern void resumable_main_cb();
  17. extern void resumable_main_modern_cb();
  18. extern void resumable_main_multi_thread();
  19. extern void resumable_main_channel_mult_thread();
  20. extern void resumable_main_when_all();
  21. extern void resumable_main_layout();
  22. extern void resumable_main_switch_scheduler();
  23. extern void resumable_main_benchmark_mem(bool wait_key);
  24. extern void benchmark_main_channel_passing_next();
  25. extern void resumable_main_benchmark_asio_server();
  26. extern void resumable_main_benchmark_asio_client(intptr_t nNum);
  27. int main(int argc, const char* argv[])
  28. {
  29. (void)argc;
  30. (void)argv;
  31. //test_ring_queue_simple<resumef::ring_queue<int>>();
  32. //test_ring_queue<resumef::ring_queue_spinlock<int, false, uint32_t>>();
  33. //test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>();
  34. //resumable_main_channel();
  35. //return 0;
  36. //if (argc > 1)
  37. // resumable_main_benchmark_asio_client(atoi(argv[1]));
  38. //else
  39. // resumable_main_benchmark_asio_server();
  40. resumable_main_cb();
  41. resumable_main_layout();
  42. resumable_main_modern_cb();
  43. resumable_main_suspend_always();
  44. resumable_main_yield_return();
  45. resumable_main_resumable();
  46. resumable_main_routine();
  47. resumable_main_exception();
  48. resumable_main_dynamic_go();
  49. resumable_main_multi_thread();
  50. resumable_main_timer();
  51. resumable_main_benchmark_mem(false);
  52. resumable_main_mutex();
  53. resumable_main_event();
  54. resumable_main_event_v2();
  55. resumable_main_event_timeout();
  56. resumable_main_channel();
  57. resumable_main_channel_mult_thread();
  58. resumable_main_sleep();
  59. resumable_main_when_all();
  60. resumable_main_switch_scheduler();
  61. std::cout << "ALL OK!" << std::endl;
  62. benchmark_main_channel_passing_next(); //ÕâÊÇÒ»¸öËÀÑ­»·²âÊÔ
  63. return 0;
  64. }