]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h
More std::jthread stuff.
[stg.git] / projects / stargazer / plugins / capture / divert_freebsd / divert_cap.h
index 04e21948ddcc3e70dc2b88278171fb9b5c46e069..5a849366d8a65c2ccba75eb8636898cb874d6d72 100644 (file)
 #include "stg/logger.h"
 
 #include <string>
-
-#include <pthread.h>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include <jthread.hpp>
+#pragma GCC diagnostic pop
 
 namespace STG
 {
@@ -61,7 +63,7 @@ private:
     DIVERT_CAP(const DIVERT_CAP & rvalue);
     DIVERT_CAP & operator=(const DIVERT_CAP & rvalue);
 
-    static void *       Run(void *);
+    void                Run(std::stop_token token) noexcept;
 
     int                 DivertCapOpen();
     int                 DivertCapOpen(int n);
@@ -76,9 +78,8 @@ private:
 
     mutable std::string errorStr;
 
-    pthread_t           thread;
+    std::jthread        m_thread;
 
-    bool                nonstop;
     bool                isRunning;
 
     STG::TraffCounter *      traffCnt;