From 2625606d4adb70709af454831a4d19c573b543f6 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 19 Aug 2024 17:10:43 +0800 Subject: [PATCH] update booster source code --- 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