Przeglądaj źródła

event_v2测试失败

tags/v2.9.7
tearshark 4 lat temu
rodzic
commit
a15e8a6dde
3 zmienionych plików z 15 dodań i 7 usunięć
  1. 5
    1
      librf/src/event_v2.h
  2. 5
    3
      librf/src/when_v2.h
  3. 5
    3
      vs_proj/librf.cpp

+ 5
- 1
librf/src/event_v2.h Wyświetl plik

timeout_awaiter wait_until(const std::chrono::time_point<_Clock, _Duration>& tp) const noexcept; timeout_awaiter wait_until(const std::chrono::time_point<_Clock, _Duration>& tp) const noexcept;





//以下wait_any/wait_all实现,借助when_any/when_all实现。
//其接口尽管兼容了v1版本的event_t,但是,其内部细节并没有兼容
//v1版本的event_t的wait_any,确保只触发了其中之一,或者超时
//而when_any会导致所有的event_t都被触发
//改日有空再补上




template<_IteratorT _Iter template<_IteratorT _Iter

+ 5
- 3
librf/src/when_v2.h Wyświetl plik

template<class _Val, _WhenIterT _Iter> template<class _Val, _WhenIterT _Iter>
inline void when_all_range__(scheduler_t& sch, state_when_t* state, std::vector<_Val> & values, _Iter begin, _Iter end) inline void when_all_range__(scheduler_t& sch, state_when_t* state, std::vector<_Val> & values, _Iter begin, _Iter end)
{ {
using _Awaitable = decltype(*begin);
using _Awaitable = std::remove_reference_t<decltype(*begin)>;


intptr_t _Idx = 0; intptr_t _Idx = 0;
for (; begin != end; ++begin, ++_Idx) for (; begin != end; ++begin, ++_Idx)
{ {
assert(idx >= 0); assert(idx >= 0);


decltype(auto) awaitor = when_real_awaitor(task);
auto awaitor = when_real_awaitor(task);


using value_type = awaitor_result_t<decltype(awaitor)>; using value_type = awaitor_result_t<decltype(awaitor)>;


template<_WhenIterT _Iter> template<_WhenIterT _Iter>
inline void when_any_range__(scheduler_t& sch, state_when_t* state, when_any_pair_ptr value, _Iter begin, _Iter end) inline void when_any_range__(scheduler_t& sch, state_when_t* state, when_any_pair_ptr value, _Iter begin, _Iter end)
{ {
using _Awaitable = std::remove_reference_t<decltype(*begin)>;

intptr_t _Idx = 0; intptr_t _Idx = 0;
for (; begin != end; ++begin, ++_Idx) for (; begin != end; ++begin, ++_Idx)
{ {
sch + when_any_connector(state, std::move(*begin), value, static_cast<intptr_t>(_Idx));
sch + when_any_connector<_Awaitable>(state, *begin, value, static_cast<intptr_t>(_Idx));
} }
} }
} }

+ 5
- 3
vs_proj/librf.cpp Wyświetl plik

//test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>(); //test_ring_queue<resumef::ring_queue_lockfree<int, uint64_t>>();
//resumable_main_switch_scheduler(); //resumable_main_switch_scheduler();
resumable_main_when_all();
//resumable_main_event_v2();
//return 0;
resumable_main_event();
resumable_main_event_v2();
resumable_main_event_timeout();
resumable_main_sleep();
return 0;
//if (argc > 1) //if (argc > 1)
// resumable_main_benchmark_asio_client(atoi(argv[1])); // resumable_main_benchmark_asio_client(atoi(argv[1]));

Ładowanie…
Anuluj
Zapisz