pw_chrono_stl#

Pigweed AI summary: The pw_chrono_stl module is a collection of pw_chrono backends that use the std::chrono library. The SystemClock backend uses std::chrono::steady_clock and the SystemTimer backend spawns a detached thread for every InvokeAt() and InvokeAfter() call. The build for pw_chrono_stl has one target: system_clock. The API is not yet stable and the current implementation of the SystemTimer backend is not efficient. See the documentation for pw_chrono

pw_chrono_stl is a collection of pw_chrono backends that are implemented using STL’s std::chrono library.

Warning

This module is still under construction, the API is not yet stable.

SystemClock backend#

Pigweed AI summary: The SystemClock backend uses the pw_chrono_stl:system_clock and implements the pw_chrono:system_clock facade by utilizing the std::chrono::steady_clock. It is important to note that the std::chrono::system_clock cannot be used as it is not always a monotonic clock source. For more information, refer to the documentation for pw_chrono.

The STL based pw_chrono_stl:system_clock backend target implements the pw_chrono:system_clock facade by using the std::chrono::steady_clock. Note that the std::chrono::system_clock cannot be used as this is not always a monotonic clock source.

See the documentation for pw_chrono for further details.

SystemTimer backend#

Pigweed AI summary: The SystemTimer backend uses the pw_chrono_stl:system_timer backend target to implement the pw_chrono:system_timer facade by creating a detached thread for each InvokeAt() and InvokeAfter() call. The thread sleeps until the expiration_deadline and then invokes the user's ExpiryCallback if it wasn't cancelled. However, the current implementation is not efficient. For more information, refer to the documentation for pw_chrono.

The STL based pw_chrono_stl:system_timer backend target implements the pw_chrono:system_timer facade by spawning a detached thread for every single InvokeAt() and InvokeAfter() call. This thread simply sleeps until the desired expiration_deadline and invokes the user’s ExpiryCallback if it wasn’t cancelled.

Warning

Although fully functional, the current implementation is NOT efficient!

See the documentation for pw_chrono for further details.

Build targets#

Pigweed AI summary: The GN build for "pw_chrono_stl" has one target called "system_clock". This target provides headers and a backend for "pw_chrono:system_clock".

The GN build for pw_chrono_stl has one target: system_clock. The system_clock target provides the pw_chrono_backend/system_clock_config.h and pw_chrono_backend/system_clock_inline.h headers and the backend for the pw_chrono:system_clock.