2025年5月25日 星期日

Linux user space delay

 #include <unistd.h>

usleep(100000); // 延遲 100,000 微秒 = 100 毫秒


---

#include <time.h>


struct timespec ts;

ts.tv_sec = 0;

ts.tv_nsec = 100 * 1000000L;  // 100 毫秒

nanosleep(&ts, NULL);

沒有留言:

張貼留言