]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h
Fix build on Darwin.
[stg.git] / projects / stargazer / plugins / capture / divert_freebsd / divert_cap.h
index 290754fd6a8d19196ceaa9bfa9495d80dfe19051..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
 {
-struct Users;
-struct Tariffs;
+class Users;
+class Tariffs;
 struct Admins;
 struct TraffCounter;
 struct Settings;
@@ -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;