test.c
#include <unistd.h>
void main() {
sleep(5);
}
gcc test.c -o test.out
strace ./test.out
out
strace ./test.out
execve("./test.out", ["./test.out"], 0x7ffea75e6b50 /* 25 vars */) = 0
brk(NULL) = 0x55b534a49000
#....省略中间输出
nanosleep({tv_sec=5, tv_nsec=0}, 0x7ffc08dcebe0) = 0
exit_group(0) = ?
+++ exited with 0 +++
sleep 时间可以稍微调大一些, 这样在输出
nanosleep
后会有明显的等待