]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Set a FIFO scheduling policy and a priority of -6 so tat the timinig accuracy stays...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 2 May 2024 15:13:56 +0000 (16:13 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 2 May 2024 15:13:56 +0000 (16:13 +0100)
nqptp.c
nqptp.service.in

diff --git a/nqptp.c b/nqptp.c
index 73b0d660e579043d59039d7931c3f1f639a9f442..34a72dac2a23d8c26175bc5b9da0ed2b62c1ec59 100644 (file)
--- a/nqptp.c
+++ b/nqptp.c
@@ -185,7 +185,16 @@ int main(int argc, char **argv) {
 
   // debug(1, "size of a clock entry is %u bytes.", sizeof(clock_source_private_data));
   atexit(goodbye);
-
+  
+  
+  // try to set a real time scheduling policy with a priority of -6
+  int policy = SCHED_FIFO;
+  struct sched_param param;
+  param.sched_priority = 5;
+  int s = pthread_setschedparam(pthread_self(), policy, &param);
+  if (s != 0)
+    debug(1, "pthread_setschedparam failed:  %d -- \"%s\".", s, strerror(s));
   sockets_open_stuff.sockets_open = 0;
 
   // open PTP sockets
index 56891d7ff36d277eae4c3b22c75dbf28350382f2..34e59f9bb8dbfea5704de4914a9de433061340b5 100644 (file)
@@ -7,6 +7,7 @@ Before=shairport-sync.service
 [Service]
 ExecStart=@prefix@/bin/nqptp
 DynamicUser=yes
+LimitRTPRIO=6
 AmbientCapabilities=CAP_NET_BIND_SERVICE
 
 [Install]