Nanosleep for slot Ind, warning fixes, WLS changes, memory leak fixes
[o-du/l2.git] / src / phy_stub / l1_bdy2.c
index 1db65f4..67f66f8 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <time.h>
 #include "lphy_stub.h"
 #include "du_log.h"
 
@@ -28,13 +29,18 @@ uint16_t l1BuildAndSendSlotIndication();
 
 void *GenerateTicks(void *arg)
 {
-   uint8_t counter = 100;
-   while(counter)
+   int     milisec = 1;        /* 1ms */
+   struct timespec req = {0};
+
+   req.tv_sec = 0;
+   req.tv_nsec = milisec * 1000000L;
+
+   while(1)
    {
-      sleep(1);
+      nanosleep(&req, (struct timespec *)NULL);
+      
       /* Send Slot indication indication to lower mac */
       l1BuildAndSendSlotIndication();
-      counter--;
    }
    return((void *)NULLP);
 }