Add mutex protection to BaseMachineState members.

This change introduces a mutex to guard the state variables within BaseMachineState and its derived classes, such as health, timestamps, and event IDs. This ensures thread safety when multiple threads access or modify these state variables. Additionally, calls to Shutdown() are added to destructors where necessary to ensure proper cleanup.

PiperOrigin-RevId: 889887042
Change-Id: I7c2278ed073444af0e563e0ae3ee661803b376ed
3 files changed