diff --git a/src/mbpfan.c b/src/mbpfan.c
index 2be29c8..acbdc08 100644
--- a/src/mbpfan.c
+++ b/src/mbpfan.c
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+#include <time.h>
#include <math.h>
#include <syslog.h>
#include <stdbool.h>
@@ -571,6 +572,11 @@ void mbpfan()
}
}
- sleep(polling_interval);
+ // call nanosleep instead of sleep to avoid rt_sigprocmask and
+ // rt_sigaction
+ struct timespec ts;
+ ts.tv_sec = polling_interval;
+ ts.tv_nsec = 0;
+ nanosleep(&ts, NULL);
}
}
Call nanosleep instead of sleep in polling loop
This avoids unnecessary rt_sigprocmask and rt_sigaction system calls.
ca52e9cefdb919740ce34f325e8521ccba549728
Andrew Gaul <andrew@gaul.org> · 2017-07-14T12:00 ·
browse files at this commit
parents:
6aba92d