refactor: use std::jthread for a proper cleanup

Change-Id: I326cdc84dac5b86acdd64fb73fced8c1412cd5a5
diff --git a/src/ietf-hardware/FspYh.cpp b/src/ietf-hardware/FspYh.cpp
index eb976c1..f958667 100644
--- a/src/ietf-hardware/FspYh.cpp
+++ b/src/ietf-hardware/FspYh.cpp
@@ -87,7 +87,7 @@
 
 void FspYh::startThread()
 {
-    m_psuWatcher = std::thread([this] {
+    m_psuWatcher = std::jthread([this] {
         while (!m_exit) {
             if (m_i2c->isPresent()) {
                 if (!std::filesystem::is_directory(m_hwmonDir)) {
@@ -119,7 +119,6 @@
 FspYh::~FspYh()
 {
     m_exit = true;
-    m_psuWatcher.join();
 }
 
 SensorPollData FspYh::readValues()
diff --git a/src/ietf-hardware/FspYh.h b/src/ietf-hardware/FspYh.h
index dd6e558..3d5eb54 100644
--- a/src/ietf-hardware/FspYh.h
+++ b/src/ietf-hardware/FspYh.h
@@ -41,7 +41,7 @@
 protected:
     std::mutex m_mtx;
     std::condition_variable m_cond;
-    std::thread m_psuWatcher;
+    std::jthread m_psuWatcher;
     std::atomic<bool> m_exit;
     std::shared_ptr<TransientI2C> m_i2c;