Skip to content

Commit af4cceb

Browse files
committed
Document Timeout
1 parent 022c605 commit af4cceb

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

lib/base/io-engine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ void AsioConditionVariable::Wait(boost::asio::yield_context yc)
146146
m_Timer.async_wait(yc[ec]);
147147
}
148148

149+
/**
150+
* Unschedules any callback scheduled by the constructor, unless it has already been run.
151+
*/
149152
void Timeout::Cancel()
150153
{
151154
boost::system::error_code ec;

lib/base/io-engine.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class Timeout : public SharedObject
174174
public:
175175
DECLARE_PTR_TYPEDEFS(Timeout);
176176

177+
/**
178+
* Schedules onTimeout to be run after timeoutFromNow on strand.
179+
*/
177180
template<class OnTimeout>
178181
Timeout(boost::asio::io_context::strand& strand, const decltype(m_Timer)::duration_type& timeoutFromNow, OnTimeout onTimeout)
179182
: m_Timer(strand.context(), timeoutFromNow)
@@ -187,6 +190,11 @@ class Timeout : public SharedObject
187190
}));
188191
}
189192

193+
/**
194+
* Unschedules any callback scheduled by the constructor, unless it has already been run.
195+
*/
196+
~Timeout() override = default;
197+
190198
void Cancel();
191199
};
192200

0 commit comments

Comments
 (0)