From e8d34d11799fc79c7c53bdcd40f9b4ee7be7a2c5 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 25 Sep 2024 17:42:22 +0800
Subject: [PATCH] Merge branch 'master' of ssh://weike-iot.com:2280/framwork

---
 booster/util_proc.h |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/booster/util_proc.h b/booster/util_proc.h
index 009cf70..89856c6 100644
--- a/booster/util_proc.h
+++ b/booster/util_proc.h
@@ -8,13 +8,14 @@
  *        Version:  1.0.0(7/06/2012~)
  *         Author:  Guo Wenxue <guowenxue@gmail.com>
  *      ChangeLog:  1, Release initial version on "7/06/2012 09:21:33 PM"
- *                 
+ *
  ********************************************************************************/
 
 #ifndef __UTIL_PROC_H_
 #define __UTIL_PROC_H_
 
 #include <signal.h>
+#include <time.h>
 
 #define PID_ASCII_SIZE  11
 
@@ -59,9 +60,30 @@
  * |   Low level API     |
  * +---------------------+*/
 
-
-
 /* get daemon process ID from $pid_file   */
 extern pid_t get_daemon_pid(const char *pid_file);
 
+/* +------------------------+
+ * |  inline functions API  |
+ * +------------------------+*/
+static inline void msleep(unsigned long ms)
+{
+    struct timespec cSleep;
+    unsigned long ulTmp;
+
+    cSleep.tv_sec = ms / 1000;
+    if (cSleep.tv_sec == 0)
+    {
+        ulTmp = ms * 10000;
+        cSleep.tv_nsec = ulTmp * 100;
+    }
+    else
+    {
+        cSleep.tv_nsec = 0;
+    }
+
+    nanosleep(&cSleep, 0);
+    return ;
+}
+
 #endif

--
Gitblit v1.9.1