]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h
Fix build on Darwin.
[stg.git] / projects / stargazer / plugins / capture / ether_freebsd / ether_cap.h
index 07380bda4fe1cefbb6cfa922cdafda81f05d2025..a416727401f0ba8517bdd5fa360cf654ccf4fe78 100644 (file)
 
 #include <string>
 #include <vector>
 
 #include <string>
 #include <vector>
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+#include <jthread.hpp>
+#pragma GCC diagnostic pop
 #include <cstdint>
 
 #include <cstdint>
 
-#include <pthread.h>
 #include <sys/poll.h>
 
 #define BUFF_LEN (128)
 #include <sys/poll.h>
 
 #define BUFF_LEN (128)
@@ -114,7 +117,7 @@ private:
     BPF_CAP(const BPF_CAP & rvalue);
     BPF_CAP & operator=(const BPF_CAP & rvalue);
 
     BPF_CAP(const BPF_CAP & rvalue);
     BPF_CAP & operator=(const BPF_CAP & rvalue);
 
-    static void *       Run(void *);
+    void                Run(std::stop_token token);
     int                 BPFCapOpen();
     int                 BPFCapOpen(BPF_DATA * bd);
     int                 BPFCapClose();
     int                 BPFCapOpen();
     int                 BPFCapOpen(BPF_DATA * bd);
     int                 BPFCapClose();
@@ -128,8 +131,7 @@ private:
     std::vector<BPF_DATA> bpfData;
     std::vector<pollfd>   polld;
 
     std::vector<BPF_DATA> bpfData;
     std::vector<pollfd>   polld;
 
-    pthread_t             thread;
-    bool                  nonstop;
+    std::jthread          m_thread;
     bool                  isRunning;
     int                   capSock;
     STG::ModuleSettings       settings;
     bool                  isRunning;
     int                   capSock;
     STG::ModuleSettings       settings;