2 // basic_waitable_timer.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
12 #define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #include <boost/asio/any_io_executor.hpp>
21 #include <boost/asio/detail/chrono_time_traits.hpp>
22 #include <boost/asio/detail/deadline_timer_service.hpp>
23 #include <boost/asio/detail/handler_type_requirements.hpp>
24 #include <boost/asio/detail/io_object_impl.hpp>
25 #include <boost/asio/detail/non_const_lvalue.hpp>
26 #include <boost/asio/detail/throw_error.hpp>
27 #include <boost/asio/error.hpp>
28 #include <boost/asio/wait_traits.hpp>
30 #if defined(BOOST_ASIO_HAS_MOVE)
32 #endif // defined(BOOST_ASIO_HAS_MOVE)
34 #include <boost/asio/detail/push_options.hpp>
39 #if !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
40 #define BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL
42 // Forward declaration with defaulted arguments.
43 template <typename Clock,
44 typename WaitTraits = boost::asio::wait_traits<Clock>,
45 typename Executor = any_io_executor>
46 class basic_waitable_timer;
48 #endif // !defined(BOOST_ASIO_BASIC_WAITABLE_TIMER_FWD_DECL)
50 /// Provides waitable timer functionality.
52 * The basic_waitable_timer class template provides the ability to perform a
53 * blocking or asynchronous wait for a timer to expire.
55 * A waitable timer is always in one of two states: "expired" or "not expired".
56 * If the wait() or async_wait() function is called on an expired timer, the
57 * wait operation will complete immediately.
59 * Most applications will use one of the boost::asio::steady_timer,
60 * boost::asio::system_timer or boost::asio::high_resolution_timer typedefs.
62 * @note This waitable timer functionality is for use with the C++11 standard
63 * library's @c <chrono> facility, or with the Boost.Chrono library.
66 * @e Distinct @e objects: Safe.@n
67 * @e Shared @e objects: Unsafe.
70 * Performing a blocking wait (C++11):
72 * // Construct a timer without setting an expiry time.
73 * boost::asio::steady_timer timer(my_context);
75 * // Set an expiry time relative to now.
76 * timer.expires_after(std::chrono::seconds(5));
78 * // Wait for the timer to expire.
83 * Performing an asynchronous wait (C++11):
85 * void handler(const boost::system::error_code& error)
95 * // Construct a timer with an absolute expiry time.
96 * boost::asio::steady_timer timer(my_context,
97 * std::chrono::steady_clock::now() + std::chrono::seconds(60));
99 * // Start an asynchronous wait.
100 * timer.async_wait(handler);
103 * @par Changing an active waitable timer's expiry time
105 * Changing the expiry time of a timer while there are pending asynchronous
106 * waits causes those wait operations to be cancelled. To ensure that the action
107 * associated with the timer is performed only once, use something like this:
111 * void on_some_event()
113 * if (my_timer.expires_after(seconds(5)) > 0)
115 * // We managed to cancel the timer. Start new asynchronous wait.
116 * my_timer.async_wait(on_timeout);
120 * // Too late, timer has already expired!
124 * void on_timeout(const boost::system::error_code& e)
126 * if (e != boost::asio::error::operation_aborted)
128 * // Timer was not cancelled, take necessary action.
133 * @li The boost::asio::basic_waitable_timer::expires_after() function
134 * cancels any pending asynchronous waits, and returns the number of
135 * asynchronous waits that were cancelled. If it returns 0 then you were too
136 * late and the wait handler has already been executed, or will soon be
137 * executed. If it returns 1 then the wait handler was successfully cancelled.
139 * @li If a wait handler is cancelled, the boost::system::error_code passed to
140 * it contains the value boost::asio::error::operation_aborted.
142 template <typename Clock, typename WaitTraits, typename Executor>
143 class basic_waitable_timer
146 /// The type of the executor associated with the object.
147 typedef Executor executor_type;
149 /// Rebinds the timer type to another executor.
150 template <typename Executor1>
151 struct rebind_executor
153 /// The timer type when rebound to the specified executor.
154 typedef basic_waitable_timer<Clock, WaitTraits, Executor1> other;
158 typedef Clock clock_type;
160 /// The duration type of the clock.
161 typedef typename clock_type::duration duration;
163 /// The time point type of the clock.
164 typedef typename clock_type::time_point time_point;
166 /// The wait traits type.
167 typedef WaitTraits traits_type;
171 * This constructor creates a timer without setting an expiry time. The
172 * expires_at() or expires_after() functions must be called to set an expiry
173 * time before the timer can be waited on.
175 * @param ex The I/O executor that the timer will use, by default, to
176 * dispatch handlers for any asynchronous operations performed on the timer.
178 explicit basic_waitable_timer(const executor_type& ex)
185 * This constructor creates a timer without setting an expiry time. The
186 * expires_at() or expires_after() functions must be called to set an expiry
187 * time before the timer can be waited on.
189 * @param context An execution context which provides the I/O executor that
190 * the timer will use, by default, to dispatch handlers for any asynchronous
191 * operations performed on the timer.
193 template <typename ExecutionContext>
194 explicit basic_waitable_timer(ExecutionContext& context,
196 is_convertible<ExecutionContext&, execution_context&>::value
202 /// Constructor to set a particular expiry time as an absolute time.
204 * This constructor creates a timer and sets the expiry time.
206 * @param ex The I/O executor object that the timer will use, by default, to
207 * dispatch handlers for any asynchronous operations performed on the timer.
209 * @param expiry_time The expiry time to be used for the timer, expressed
210 * as an absolute time.
212 basic_waitable_timer(const executor_type& ex, const time_point& expiry_time)
215 boost::system::error_code ec;
216 impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
217 boost::asio::detail::throw_error(ec, "expires_at");
220 /// Constructor to set a particular expiry time as an absolute time.
222 * This constructor creates a timer and sets the expiry time.
224 * @param context An execution context which provides the I/O executor that
225 * the timer will use, by default, to dispatch handlers for any asynchronous
226 * operations performed on the timer.
228 * @param expiry_time The expiry time to be used for the timer, expressed
229 * as an absolute time.
231 template <typename ExecutionContext>
232 explicit basic_waitable_timer(ExecutionContext& context,
233 const time_point& expiry_time,
235 is_convertible<ExecutionContext&, execution_context&>::value
239 boost::system::error_code ec;
240 impl_.get_service().expires_at(impl_.get_implementation(), expiry_time, ec);
241 boost::asio::detail::throw_error(ec, "expires_at");
244 /// Constructor to set a particular expiry time relative to now.
246 * This constructor creates a timer and sets the expiry time.
248 * @param ex The I/O executor that the timer will use, by default, to
249 * dispatch handlers for any asynchronous operations performed on the timer.
251 * @param expiry_time The expiry time to be used for the timer, relative to
254 basic_waitable_timer(const executor_type& ex, const duration& expiry_time)
257 boost::system::error_code ec;
258 impl_.get_service().expires_after(
259 impl_.get_implementation(), expiry_time, ec);
260 boost::asio::detail::throw_error(ec, "expires_after");
263 /// Constructor to set a particular expiry time relative to now.
265 * This constructor creates a timer and sets the expiry time.
267 * @param context An execution context which provides the I/O executor that
268 * the timer will use, by default, to dispatch handlers for any asynchronous
269 * operations performed on the timer.
271 * @param expiry_time The expiry time to be used for the timer, relative to
274 template <typename ExecutionContext>
275 explicit basic_waitable_timer(ExecutionContext& context,
276 const duration& expiry_time,
278 is_convertible<ExecutionContext&, execution_context&>::value
282 boost::system::error_code ec;
283 impl_.get_service().expires_after(
284 impl_.get_implementation(), expiry_time, ec);
285 boost::asio::detail::throw_error(ec, "expires_after");
288 #if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
289 /// Move-construct a basic_waitable_timer from another.
291 * This constructor moves a timer from one object to another.
293 * @param other The other basic_waitable_timer object from which the move will
296 * @note Following the move, the moved-from object is in the same state as if
297 * constructed using the @c basic_waitable_timer(const executor_type&)
300 basic_waitable_timer(basic_waitable_timer&& other)
301 : impl_(std::move(other.impl_))
305 /// Move-assign a basic_waitable_timer from another.
307 * This assignment operator moves a timer from one object to another. Cancels
308 * any outstanding asynchronous operations associated with the target object.
310 * @param other The other basic_waitable_timer object from which the move will
313 * @note Following the move, the moved-from object is in the same state as if
314 * constructed using the @c basic_waitable_timer(const executor_type&)
317 basic_waitable_timer& operator=(basic_waitable_timer&& other)
319 impl_ = std::move(other.impl_);
323 // All timers have access to each other's implementations.
324 template <typename Clock1, typename WaitTraits1, typename Executor1>
325 friend class basic_waitable_timer;
327 /// Move-construct a basic_waitable_timer from another.
329 * This constructor moves a timer from one object to another.
331 * @param other The other basic_waitable_timer object from which the move will
334 * @note Following the move, the moved-from object is in the same state as if
335 * constructed using the @c basic_waitable_timer(const executor_type&)
338 template <typename Executor1>
339 basic_waitable_timer(
340 basic_waitable_timer<Clock, WaitTraits, Executor1>&& other,
342 is_convertible<Executor1, Executor>::value
344 : impl_(std::move(other.impl_))
348 /// Move-assign a basic_waitable_timer from another.
350 * This assignment operator moves a timer from one object to another. Cancels
351 * any outstanding asynchronous operations associated with the target object.
353 * @param other The other basic_waitable_timer object from which the move will
356 * @note Following the move, the moved-from object is in the same state as if
357 * constructed using the @c basic_waitable_timer(const executor_type&)
360 template <typename Executor1>
362 is_convertible<Executor1, Executor>::value,
363 basic_waitable_timer&
364 >::type operator=(basic_waitable_timer<Clock, WaitTraits, Executor1>&& other)
366 basic_waitable_timer tmp(std::move(other));
367 impl_ = std::move(tmp.impl_);
370 #endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
372 /// Destroys the timer.
374 * This function destroys the timer, cancelling any outstanding asynchronous
375 * wait operations associated with the timer as if by calling @c cancel.
377 ~basic_waitable_timer()
381 /// Get the executor associated with the object.
382 executor_type get_executor() BOOST_ASIO_NOEXCEPT
384 return impl_.get_executor();
387 /// Cancel any asynchronous operations that are waiting on the timer.
389 * This function forces the completion of any pending asynchronous wait
390 * operations against the timer. The handler for each cancelled operation will
391 * be invoked with the boost::asio::error::operation_aborted error code.
393 * Cancelling the timer does not change the expiry time.
395 * @return The number of asynchronous operations that were cancelled.
397 * @throws boost::system::system_error Thrown on failure.
399 * @note If the timer has already expired when cancel() is called, then the
400 * handlers for asynchronous wait operations will:
402 * @li have already been invoked; or
404 * @li have been queued for invocation in the near future.
406 * These handlers can no longer be cancelled, and therefore are passed an
407 * error code that indicates the successful completion of the wait operation.
411 boost::system::error_code ec;
412 std::size_t s = impl_.get_service().cancel(impl_.get_implementation(), ec);
413 boost::asio::detail::throw_error(ec, "cancel");
417 #if !defined(BOOST_ASIO_NO_DEPRECATED)
418 /// (Deprecated: Use non-error_code overload.) Cancel any asynchronous
419 /// operations that are waiting on the timer.
421 * This function forces the completion of any pending asynchronous wait
422 * operations against the timer. The handler for each cancelled operation will
423 * be invoked with the boost::asio::error::operation_aborted error code.
425 * Cancelling the timer does not change the expiry time.
427 * @param ec Set to indicate what error occurred, if any.
429 * @return The number of asynchronous operations that were cancelled.
431 * @note If the timer has already expired when cancel() is called, then the
432 * handlers for asynchronous wait operations will:
434 * @li have already been invoked; or
436 * @li have been queued for invocation in the near future.
438 * These handlers can no longer be cancelled, and therefore are passed an
439 * error code that indicates the successful completion of the wait operation.
441 std::size_t cancel(boost::system::error_code& ec)
443 return impl_.get_service().cancel(impl_.get_implementation(), ec);
445 #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
447 /// Cancels one asynchronous operation that is waiting on the timer.
449 * This function forces the completion of one pending asynchronous wait
450 * operation against the timer. Handlers are cancelled in FIFO order. The
451 * handler for the cancelled operation will be invoked with the
452 * boost::asio::error::operation_aborted error code.
454 * Cancelling the timer does not change the expiry time.
456 * @return The number of asynchronous operations that were cancelled. That is,
459 * @throws boost::system::system_error Thrown on failure.
461 * @note If the timer has already expired when cancel_one() is called, then
462 * the handlers for asynchronous wait operations will:
464 * @li have already been invoked; or
466 * @li have been queued for invocation in the near future.
468 * These handlers can no longer be cancelled, and therefore are passed an
469 * error code that indicates the successful completion of the wait operation.
471 std::size_t cancel_one()
473 boost::system::error_code ec;
474 std::size_t s = impl_.get_service().cancel_one(
475 impl_.get_implementation(), ec);
476 boost::asio::detail::throw_error(ec, "cancel_one");
480 #if !defined(BOOST_ASIO_NO_DEPRECATED)
481 /// (Deprecated: Use non-error_code overload.) Cancels one asynchronous
482 /// operation that is waiting on the timer.
484 * This function forces the completion of one pending asynchronous wait
485 * operation against the timer. Handlers are cancelled in FIFO order. The
486 * handler for the cancelled operation will be invoked with the
487 * boost::asio::error::operation_aborted error code.
489 * Cancelling the timer does not change the expiry time.
491 * @param ec Set to indicate what error occurred, if any.
493 * @return The number of asynchronous operations that were cancelled. That is,
496 * @note If the timer has already expired when cancel_one() is called, then
497 * the handlers for asynchronous wait operations will:
499 * @li have already been invoked; or
501 * @li have been queued for invocation in the near future.
503 * These handlers can no longer be cancelled, and therefore are passed an
504 * error code that indicates the successful completion of the wait operation.
506 std::size_t cancel_one(boost::system::error_code& ec)
508 return impl_.get_service().cancel_one(impl_.get_implementation(), ec);
511 /// (Deprecated: Use expiry().) Get the timer's expiry time as an absolute
514 * This function may be used to obtain the timer's current expiry time.
515 * Whether the timer has expired or not does not affect this value.
517 time_point expires_at() const
519 return impl_.get_service().expires_at(impl_.get_implementation());
521 #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
523 /// Get the timer's expiry time as an absolute time.
525 * This function may be used to obtain the timer's current expiry time.
526 * Whether the timer has expired or not does not affect this value.
528 time_point expiry() const
530 return impl_.get_service().expiry(impl_.get_implementation());
533 /// Set the timer's expiry time as an absolute time.
535 * This function sets the expiry time. Any pending asynchronous wait
536 * operations will be cancelled. The handler for each cancelled operation will
537 * be invoked with the boost::asio::error::operation_aborted error code.
539 * @param expiry_time The expiry time to be used for the timer.
541 * @return The number of asynchronous operations that were cancelled.
543 * @throws boost::system::system_error Thrown on failure.
545 * @note If the timer has already expired when expires_at() is called, then
546 * the handlers for asynchronous wait operations will:
548 * @li have already been invoked; or
550 * @li have been queued for invocation in the near future.
552 * These handlers can no longer be cancelled, and therefore are passed an
553 * error code that indicates the successful completion of the wait operation.
555 std::size_t expires_at(const time_point& expiry_time)
557 boost::system::error_code ec;
558 std::size_t s = impl_.get_service().expires_at(
559 impl_.get_implementation(), expiry_time, ec);
560 boost::asio::detail::throw_error(ec, "expires_at");
564 #if !defined(BOOST_ASIO_NO_DEPRECATED)
565 /// (Deprecated: Use non-error_code overload.) Set the timer's expiry time as
566 /// an absolute time.
568 * This function sets the expiry time. Any pending asynchronous wait
569 * operations will be cancelled. The handler for each cancelled operation will
570 * be invoked with the boost::asio::error::operation_aborted error code.
572 * @param expiry_time The expiry time to be used for the timer.
574 * @param ec Set to indicate what error occurred, if any.
576 * @return The number of asynchronous operations that were cancelled.
578 * @note If the timer has already expired when expires_at() is called, then
579 * the handlers for asynchronous wait operations will:
581 * @li have already been invoked; or
583 * @li have been queued for invocation in the near future.
585 * These handlers can no longer be cancelled, and therefore are passed an
586 * error code that indicates the successful completion of the wait operation.
588 std::size_t expires_at(const time_point& expiry_time,
589 boost::system::error_code& ec)
591 return impl_.get_service().expires_at(
592 impl_.get_implementation(), expiry_time, ec);
594 #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
596 /// Set the timer's expiry time relative to now.
598 * This function sets the expiry time. Any pending asynchronous wait
599 * operations will be cancelled. The handler for each cancelled operation will
600 * be invoked with the boost::asio::error::operation_aborted error code.
602 * @param expiry_time The expiry time to be used for the timer.
604 * @return The number of asynchronous operations that were cancelled.
606 * @throws boost::system::system_error Thrown on failure.
608 * @note If the timer has already expired when expires_after() is called,
609 * then the handlers for asynchronous wait operations will:
611 * @li have already been invoked; or
613 * @li have been queued for invocation in the near future.
615 * These handlers can no longer be cancelled, and therefore are passed an
616 * error code that indicates the successful completion of the wait operation.
618 std::size_t expires_after(const duration& expiry_time)
620 boost::system::error_code ec;
621 std::size_t s = impl_.get_service().expires_after(
622 impl_.get_implementation(), expiry_time, ec);
623 boost::asio::detail::throw_error(ec, "expires_after");
627 #if !defined(BOOST_ASIO_NO_DEPRECATED)
628 /// (Deprecated: Use expiry().) Get the timer's expiry time relative to now.
630 * This function may be used to obtain the timer's current expiry time.
631 * Whether the timer has expired or not does not affect this value.
633 duration expires_from_now() const
635 return impl_.get_service().expires_from_now(impl_.get_implementation());
638 /// (Deprecated: Use expires_after().) Set the timer's expiry time relative
641 * This function sets the expiry time. Any pending asynchronous wait
642 * operations will be cancelled. The handler for each cancelled operation will
643 * be invoked with the boost::asio::error::operation_aborted error code.
645 * @param expiry_time The expiry time to be used for the timer.
647 * @return The number of asynchronous operations that were cancelled.
649 * @throws boost::system::system_error Thrown on failure.
651 * @note If the timer has already expired when expires_from_now() is called,
652 * then the handlers for asynchronous wait operations will:
654 * @li have already been invoked; or
656 * @li have been queued for invocation in the near future.
658 * These handlers can no longer be cancelled, and therefore are passed an
659 * error code that indicates the successful completion of the wait operation.
661 std::size_t expires_from_now(const duration& expiry_time)
663 boost::system::error_code ec;
664 std::size_t s = impl_.get_service().expires_from_now(
665 impl_.get_implementation(), expiry_time, ec);
666 boost::asio::detail::throw_error(ec, "expires_from_now");
670 /// (Deprecated: Use expires_after().) Set the timer's expiry time relative
673 * This function sets the expiry time. Any pending asynchronous wait
674 * operations will be cancelled. The handler for each cancelled operation will
675 * be invoked with the boost::asio::error::operation_aborted error code.
677 * @param expiry_time The expiry time to be used for the timer.
679 * @param ec Set to indicate what error occurred, if any.
681 * @return The number of asynchronous operations that were cancelled.
683 * @note If the timer has already expired when expires_from_now() is called,
684 * then the handlers for asynchronous wait operations will:
686 * @li have already been invoked; or
688 * @li have been queued for invocation in the near future.
690 * These handlers can no longer be cancelled, and therefore are passed an
691 * error code that indicates the successful completion of the wait operation.
693 std::size_t expires_from_now(const duration& expiry_time,
694 boost::system::error_code& ec)
696 return impl_.get_service().expires_from_now(
697 impl_.get_implementation(), expiry_time, ec);
699 #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
701 /// Perform a blocking wait on the timer.
703 * This function is used to wait for the timer to expire. This function
704 * blocks and does not return until the timer has expired.
706 * @throws boost::system::system_error Thrown on failure.
710 boost::system::error_code ec;
711 impl_.get_service().wait(impl_.get_implementation(), ec);
712 boost::asio::detail::throw_error(ec, "wait");
715 /// Perform a blocking wait on the timer.
717 * This function is used to wait for the timer to expire. This function
718 * blocks and does not return until the timer has expired.
720 * @param ec Set to indicate what error occurred, if any.
722 void wait(boost::system::error_code& ec)
724 impl_.get_service().wait(impl_.get_implementation(), ec);
727 /// Start an asynchronous wait on the timer.
729 * This function may be used to initiate an asynchronous wait against the
730 * timer. It always returns immediately.
732 * For each call to async_wait(), the supplied handler will be called exactly
733 * once. The handler will be called when:
735 * @li The timer has expired.
737 * @li The timer was cancelled, in which case the handler is passed the error
738 * code boost::asio::error::operation_aborted.
740 * @param handler The handler to be called when the timer expires. Copies
741 * will be made of the handler as required. The function signature of the
743 * @code void handler(
744 * const boost::system::error_code& error // Result of operation.
746 * Regardless of whether the asynchronous operation completes immediately or
747 * not, the handler will not be invoked from within this function. On
748 * immediate completion, invocation of the handler will be performed in a
749 * manner equivalent to using boost::asio::post().
752 BOOST_ASIO_COMPLETION_TOKEN_FOR(void (boost::system::error_code))
753 WaitHandler BOOST_ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
754 BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(WaitHandler,
755 void (boost::system::error_code))
757 BOOST_ASIO_MOVE_ARG(WaitHandler) handler
758 BOOST_ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
760 return async_initiate<WaitHandler, void (boost::system::error_code)>(
761 initiate_async_wait(this), handler);
765 // Disallow copying and assignment.
766 basic_waitable_timer(const basic_waitable_timer&) BOOST_ASIO_DELETED;
767 basic_waitable_timer& operator=(
768 const basic_waitable_timer&) BOOST_ASIO_DELETED;
770 class initiate_async_wait
773 typedef Executor executor_type;
775 explicit initiate_async_wait(basic_waitable_timer* self)
780 executor_type get_executor() const BOOST_ASIO_NOEXCEPT
782 return self_->get_executor();
785 template <typename WaitHandler>
786 void operator()(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) const
788 // If you get an error on the following line it means that your handler
789 // does not meet the documented type requirements for a WaitHandler.
790 BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check;
792 detail::non_const_lvalue<WaitHandler> handler2(handler);
793 self_->impl_.get_service().async_wait(
794 self_->impl_.get_implementation(),
795 handler2.value, self_->impl_.get_executor());
799 basic_waitable_timer* self_;
802 detail::io_object_impl<
803 detail::deadline_timer_service<
804 detail::chrono_time_traits<Clock, WaitTraits> >,
805 executor_type > impl_;
811 #include <boost/asio/detail/pop_options.hpp>
813 #endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP