@@ -50,16 +50,14 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
5050
5151 @return An executor associated with this context.
5252 */
53- executor_type
54- get_executor () const noexcept ;
53+ executor_type get_executor () const noexcept ;
5554
5655 /* * Signal the context to stop processing.
5756
5857 This causes `run()` to return as soon as possible. Any pending
5958 work items remain queued.
6059 */
61- void
62- stop ()
60+ void stop ()
6361 {
6462 sched_->stop ();
6563 }
@@ -69,8 +67,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
6967 @return `true` if `stop()` has been called and `restart()`
7068 has not been called since.
7169 */
72- bool
73- stopped () const noexcept
70+ bool stopped () const noexcept
7471 {
7572 return sched_->stopped ();
7673 }
@@ -80,8 +77,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
8077 This function must be called before `run()` can be called
8178 again after `stop()` has been called.
8279 */
83- void
84- restart ()
80+ void restart ()
8581 {
8682 sched_->restart ();
8783 }
@@ -97,8 +93,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
9793
9894 @return The number of handlers executed.
9995 */
100- std::size_t
101- run ()
96+ std::size_t run ()
10297 {
10398 return sched_->run ();
10499 }
@@ -114,8 +109,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
114109
115110 @return The number of handlers executed (0 or 1).
116111 */
117- std::size_t
118- run_one ()
112+ std::size_t run_one ()
119113 {
120114 return sched_->run_one ();
121115 }
@@ -134,8 +128,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
134128 @return The number of handlers executed.
135129 */
136130 template <class Rep , class Period >
137- std::size_t
138- run_for (std::chrono::duration<Rep, Period> const & rel_time)
131+ std::size_t run_for (std::chrono::duration<Rep, Period> const & rel_time)
139132 {
140133 return run_until (std::chrono::steady_clock::now () + rel_time);
141134 }
@@ -178,8 +171,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
178171 @return The number of handlers executed (0 or 1).
179172 */
180173 template <class Rep , class Period >
181- std::size_t
182- run_one_for (std::chrono::duration<Rep, Period> const & rel_time)
174+ std::size_t run_one_for (std::chrono::duration<Rep, Period> const & rel_time)
183175 {
184176 return run_one_until (std::chrono::steady_clock::now () + rel_time);
185177 }
@@ -209,8 +201,10 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
209201 rel_time = std::chrono::seconds (1 );
210202
211203 std::size_t s = sched_->wait_one (
212- static_cast <long >(std::chrono::duration_cast<
213- std::chrono::microseconds>(rel_time).count ()));
204+ static_cast <long >(
205+ std::chrono::duration_cast<std::chrono::microseconds>(
206+ rel_time)
207+ .count ()));
214208
215209 if (s || stopped ())
216210 return s;
@@ -231,8 +225,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
231225
232226 @return The number of handlers executed.
233227 */
234- std::size_t
235- poll ()
228+ std::size_t poll ()
236229 {
237230 return sched_->poll ();
238231 }
@@ -248,8 +241,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
248241
249242 @return The number of handlers executed (0 or 1).
250243 */
251- std::size_t
252- poll_one ()
244+ std::size_t poll_one ()
253245 {
254246 return sched_->poll_one ();
255247 }
@@ -259,11 +251,7 @@ class BOOST_COROSIO_DECL basic_io_context : public capy::execution_context
259251
260252 Derived classes must set sched_ in their constructor body.
261253 */
262- basic_io_context ()
263- : capy::execution_context(this )
264- , sched_(nullptr )
265- {
266- }
254+ basic_io_context () : capy::execution_context(this ), sched_(nullptr ) {}
267255
268256 detail::scheduler* sched_;
269257};
@@ -297,18 +285,13 @@ class basic_io_context::executor_type
297285
298286 @param ctx The context to associate with this executor.
299287 */
300- explicit
301- executor_type (basic_io_context& ctx) noexcept
302- : ctx_(&ctx)
303- {
304- }
288+ explicit executor_type (basic_io_context& ctx) noexcept : ctx_(&ctx) {}
305289
306290 /* * Return a reference to the associated execution context.
307291
308292 @return Reference to the context.
309293 */
310- basic_io_context&
311- context () const noexcept
294+ basic_io_context& context () const noexcept
312295 {
313296 return *ctx_;
314297 }
@@ -317,8 +300,7 @@ class basic_io_context::executor_type
317300
318301 @return `true` if `run()` is being called on this thread.
319302 */
320- bool
321- running_in_this_thread () const noexcept
303+ bool running_in_this_thread () const noexcept
322304 {
323305 return ctx_->sched_ ->running_in_this_thread ();
324306 }
@@ -327,8 +309,7 @@ class basic_io_context::executor_type
327309
328310 Must be paired with `on_work_finished()`.
329311 */
330- void
331- on_work_started () const noexcept
312+ void on_work_started () const noexcept
332313 {
333314 ctx_->sched_ ->on_work_started ();
334315 }
@@ -338,8 +319,7 @@ class basic_io_context::executor_type
338319 @par Preconditions
339320 A preceding call to `on_work_started()` on an equal executor.
340321 */
341- void
342- on_work_finished () const noexcept
322+ void on_work_finished () const noexcept
343323 {
344324 ctx_->sched_ ->on_work_finished ();
345325 }
@@ -354,8 +334,7 @@ class basic_io_context::executor_type
354334
355335 @return A handle for symmetric transfer or `std::noop_coroutine()`.
356336 */
357- std::coroutine_handle<>
358- dispatch (std::coroutine_handle<> h) const
337+ std::coroutine_handle<> dispatch (std::coroutine_handle<> h) const
359338 {
360339 if (running_in_this_thread ())
361340 return h;
@@ -370,8 +349,7 @@ class basic_io_context::executor_type
370349
371350 @param h The coroutine handle to post.
372351 */
373- void
374- post (std::coroutine_handle<> h) const
352+ void post (std::coroutine_handle<> h) const
375353 {
376354 ctx_->sched_ ->post (h);
377355 }
@@ -380,8 +358,7 @@ class basic_io_context::executor_type
380358
381359 @return `true` if both executors refer to the same context.
382360 */
383- bool
384- operator ==(executor_type const & other) const noexcept
361+ bool operator ==(executor_type const & other) const noexcept
385362 {
386363 return ctx_ == other.ctx_ ;
387364 }
@@ -390,17 +367,14 @@ class basic_io_context::executor_type
390367
391368 @return `true` if the executors refer to different contexts.
392369 */
393- bool
394- operator !=(executor_type const & other) const noexcept
370+ bool operator !=(executor_type const & other) const noexcept
395371 {
396372 return ctx_ != other.ctx_ ;
397373 }
398374};
399375
400- inline
401- basic_io_context::executor_type
402- basic_io_context::
403- get_executor () const noexcept
376+ inline basic_io_context::executor_type
377+ basic_io_context::get_executor () const noexcept
404378{
405379 return executor_type (const_cast <basic_io_context&>(*this ));
406380}
0 commit comments