Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 1 | .. _module-pw_chrono_stl: |
| 2 | |
| 3 | ------------- |
| 4 | pw_chrono_stl |
| 5 | ------------- |
| 6 | ``pw_chrono_stl`` is a collection of ``pw_chrono`` backends that are implemented |
| 7 | using STL's ``std::chrono`` library. |
| 8 | |
| 9 | .. warning:: |
Ewout van Bekkum | 2140484 | 2021-06-08 11:06:17 -0700 | [diff] [blame] | 10 | This module is still under construction, the API is not yet stable. |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 11 | |
| 12 | SystemClock backend |
| 13 | ------------------- |
Ewout van Bekkum | 2140484 | 2021-06-08 11:06:17 -0700 | [diff] [blame] | 14 | The STL based ``pw_chrono_stl:system_clock`` backend target implements the |
| 15 | ``pw_chrono:system_clock`` facade by using the ``std::chrono::steady_clock``. |
| 16 | Note that the ``std::chrono::system_clock`` cannot be used as this is not always |
| 17 | a monotonic clock source. |
| 18 | |
| 19 | See the documentation for ``pw_chrono`` for further details. |
| 20 | |
| 21 | SystemTimer backend |
| 22 | ------------------- |
| 23 | The 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 |
| 26 | desired ``expiration_deadline`` and invokes the user's ``ExpiryCallback`` if it |
| 27 | wasn't cancelled. |
| 28 | |
| 29 | .. Warning:: |
| 30 | Although fully functional, the current implementation is NOT efficient! |
Ewout van Bekkum | 3c61ae9 | 2020-10-30 15:52:25 -0700 | [diff] [blame] | 31 | |
| 32 | See the documentation for ``pw_chrono`` for further details. |
| 33 | |
| 34 | Build targets |
| 35 | ------------- |
| 36 | The GN build for ``pw_chrono_stl`` has one target: ``system_clock``. |
Ewout van Bekkum | 01a32af | 2020-11-30 11:34:48 -0800 | [diff] [blame] | 37 | The ``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``. |