4#include "Stroika/Foundation/Execution/Timeout.h"
13 template <
typename T,
typename TRAITS>
15 optional<pair<SDKPollableType, TypeOfMonitorSet>> pollable2Wakeup)
18 , fPollable2Wakeup_{pollable2Wakeup}
22 template <
typename T,
typename TRAITS>
24 optional<pair<SDKPollableType, TypeOfMonitorSet>> pollable2Wakeup)
28 template <
typename T,
typename TRAITS>
33 template <
typename T,
typename TRAITS>
34 inline auto WaitForIOReady<T, TRAITS>::GetDescriptors () const -> Traversal::Iterable<pair<T, TypeOfMonitorSet>>
39 template <
typename T,
typename TRAITS>
42 return WaitUntil (waitFor + Time::GetTickCount ());
44 template <
typename T,
typename TRAITS>
47 return WaitQuietlyUntil (waitFor + Time::GetTickCount ());
49 template <
typename T,
typename TRAITS>
54 if (result.
empty ()) {
59 template <
typename T,
typename TRAITS>
65 auto fillBuffer = [
this] (vector<pair<SDKPollableType, TypeOfMonitorSet>>* pollBuffer, vector<T>* mappedObjectBuffer) ->
void {
68 Require (pollBuffer->size () == 0);
69 Require (mappedObjectBuffer->size () == 0);
70 pollBuffer->reserve (fPollData_.size ());
71 mappedObjectBuffer->reserve (fPollData_.size ());
72 for (
const auto& i : fPollData_) {
73 pollBuffer->push_back (pair<SDKPollableType, TypeOfMonitorSet>{TRAITS::GetSDKPollable (i.first), i.second});
74 mappedObjectBuffer->push_back (i.first);
76 if (fPollable2Wakeup_) {
77 pollBuffer->push_back (pair<SDKPollableType, TypeOfMonitorSet>{fPollable2Wakeup_.value ().first, fPollable2Wakeup_.value ().second});
82 vector<pair<SDKPollableType, TypeOfMonitorSet>> pollBuffer;
83 vector<T> mappedObjectBuffer;
85 fillBuffer (&pollBuffer, &mappedObjectBuffer);
86 Assert (pollBuffer.size () == mappedObjectBuffer.size () or pollBuffer.size () == mappedObjectBuffer.size () + 1);
89 if (i == mappedObjectBuffer.size ()) {
90 Assert (fPollable2Wakeup_);
93 Assert (i < mappedObjectBuffer.size ());
94 result.
Add (mappedObjectBuffer[i]);
104 constexpr EnumNames<Execution::WaitForIOReady_Support::WaitForIOReady_Base::TypeOfMonitor>
105 DefaultNames<Execution::WaitForIOReady_Support::WaitForIOReady_Base::TypeOfMonitor>::k{{{
106 {Execution::WaitForIOReady_Support::WaitForIOReady_Base::TypeOfMonitor::eRead, L
"Read"},
107 {Execution::WaitForIOReady_Support::WaitForIOReady_Base::TypeOfMonitor::eWrite, L
"Write"},
108 {Execution::WaitForIOReady_Support::WaitForIOReady_Base::TypeOfMonitor::ePriority, L
"Priority"},
#define RequireNotNull(p)
time_point< RealtimeClock, DurationSeconds > TimePointSeconds
TimePointSeconds is a simpler approach to chrono::time_point, which doesn't require using templates e...
chrono::duration< double > DurationSeconds
chrono::duration<double> - a time span (length of time) measured in seconds, but high precision.
Set<T> is a container of T, where once an item is added, additionally adds () do nothing.
nonvirtual void Add(ArgByValueType< value_type > item)
unique_lock< AssertExternallySynchronizedChecker > WriteContext
Instantiate AssertExternallySynchronizedChecker::WriteContext to designate an area of code where prot...
shared_lock< const AssertExternallySynchronizedChecker > ReadContext
Instantiate AssertExternallySynchronizedChecker::ReadContext to designate an area of code where prote...
nonvirtual Containers::Set< T > WaitQuietlyUntil(Time::TimePointSeconds timeoutAt=Time::TimePointSeconds{Time::kInfinity})
nonvirtual Containers::Set< T > WaitQuietly(Time::DurationSeconds waitFor=Time::kInfinity)
WaitForIOReady(const Traversal::Iterable< pair< T, TypeOfMonitorSet > > &fds, optional< pair< SDKPollableType, TypeOfMonitorSet > > pollable2Wakeup=nullopt)
Watch each of fds for the events paired with it - or, in the other overloads, all of fds (or the one ...
nonvirtual Containers::Set< T > WaitUntil(Time::TimePointSeconds timeoutAt=Time::TimePointSeconds{Time::kInfinity})
nonvirtual Containers::Set< T > Wait(Time::DurationSeconds waitFor=Time::kInfinity)
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
nonvirtual bool empty() const
Returns true iff size() == 0.
CONTAINER::value_type * End(CONTAINER &c)
For a contiguous container (such as a vector or basic_string) - find the pointer to the end of the co...
CONTAINER::value_type * Start(CONTAINER &c)
For a contiguous container (such as a vector or basic_string) - find the pointer to the start of the ...
void CheckForInterruption()
void ThrowTimeoutExceptionAfter(Time::TimePointSeconds afterTickCount, EXCEPTION &&exception2Throw)
How Stroika reports a timeout.