blob: b1aea39fac8196a4098470f05140c89d75f7fc6b [file] [log] [blame]
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -07001.. _module-pw_chrono_stl:
2
3-------------
4pw_chrono_stl
5-------------
6``pw_chrono_stl`` is a collection of ``pw_chrono`` backends that are implemented
7using STL's ``std::chrono`` library.
8
9.. warning::
Ewout van Bekkum21404842021-06-08 11:06:17 -070010 This module is still under construction, the API is not yet stable.
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -070011
12SystemClock backend
13-------------------
Ewout van Bekkum21404842021-06-08 11:06:17 -070014The STL based ``pw_chrono_stl:system_clock`` backend target implements the
15``pw_chrono:system_clock`` facade by using the ``std::chrono::steady_clock``.
16Note that the ``std::chrono::system_clock`` cannot be used as this is not always
17a monotonic clock source.
18
19See the documentation for ``pw_chrono`` for further details.
20
21SystemTimer backend
22-------------------
23The STL based ``pw_chrono_stl:system_timer`` backend target implements the
24``pw_chrono:system_timer`` facade by spawning a detached thread for every single
25``InvokeAt()`` and ``InvokeAfter()`` call. This thread simply sleeps until the
26desired ``expiration_deadline`` and invokes the user's ``ExpiryCallback`` if it
27wasn't cancelled.
28
29.. Warning::
30 Although fully functional, the current implementation is NOT efficient!
Ewout van Bekkum3c61ae92020-10-30 15:52:25 -070031
32See the documentation for ``pw_chrono`` for further details.
33
34Build targets
35-------------
36The GN build for ``pw_chrono_stl`` has one target: ``system_clock``.
Ewout van Bekkum01a32af2020-11-30 11:34:48 -080037The ``system_clock`` target provides the
38``pw_chrono_backend/system_clock_config.h`` and
39``pw_chrono_backend/system_clock_inline.h`` headers and the backend for the
40``pw_chrono:system_clock``.