]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/capture/divert_freebsd/divert_cap.cpp
Replace deprecated usleep with POSIX-compliant nanosleep
[stg.git] / projects / stargazer / plugins / capture / divert_freebsd / divert_cap.cpp
index 603c520994bf11fa8075f4f36a0ab41ffa7d4343..5927727e516a221dcc716bf87f58ef8258beaa9f 100644 (file)
@@ -80,7 +80,10 @@ return "Divert_cap v.1.0";
 }
 //-----------------------------------------------------------------------------
 DIVERT_CAP::DIVERT_CAP()
-    : port(0),
+    : settings(),
+      port(0),
+      errorStr(),
+      thread(),
       nonstop(false),
       isRunning(false),
       traffCnt(NULL)
@@ -127,7 +130,8 @@ for (i = 0; i < 25; i++)
     if (!isRunning)
         break;
 
-    usleep(200000);
+    struct timespec ts = {0, 200000000};
+    nanosleep(&ts, NULL);
     }
 
 //after 5 seconds waiting thread still running. now killing it