]> lisas.de Git - aseqjoy.git/commitdiff
Workaround for the JACK/SCHED_FIFO issue - Alex
authorterminatorX <>
Fri, 22 Aug 2003 09:03:59 +0000 (09:03 +0000)
committerterminatorX <>
Fri, 22 Aug 2003 09:03:59 +0000 (09:03 +0000)
terminatorX/ChangeLog
terminatorX/src/tX_engine.cc

index a16bf70752fee05a847eaee46b6e4ece655be4bf..d2b75ed126c378487a550ade66fec0c6e7efab4e 100644 (file)
@@ -4,6 +4,9 @@ This is not a GNU-style ChangeLog but you sort of get the idea what was
 changed.
 
 [v3.81]
+- JACK doesn't seem to like SCHED_FIFO clients so I added a little switch that
+  will set SCHED_OTHER when jack output was selected. This will work for true
+  root or a capabilities-enabled suid-root binary only.
 - removed the disfunctional "Cancel" button from the load-progress dialog.
 - switched default MIDI mapping to non-destructive. (previous settings will not
   be overwritten now).
index 9eaa89d2aec3f369d5e2bf139608c30b2c732ed8..87a45e670a0142f9db86dac067fe06169aafc48d 100644 (file)
@@ -118,6 +118,30 @@ void tX_engine::loop() {
        while (!thread_terminate) {
                /* Waiting for the trigger */
                pthread_mutex_lock(&start);
+#ifdef USE_SCHEDULER
+               pid_t pid=getpid();
+               struct sched_param parm;
+                       
+               if (globals.use_realtime && (globals.audiodevice_type!=JACK)) {
+                       sched_getparam(pid, &parm);
+                       parm.sched_priority=sched_get_priority_max(SCHED_FIFO);
+                                               
+                       if (pthread_setschedparam(pthread_self(), SCHED_FIFO, &parm)) {
+                               tX_error("loop(): failed to set realtime priority.");
+                       } else {
+                               tX_debug("loop(): set SCHED_FIFO.");
+                       }
+               } else {
+                       sched_getparam(pid, &parm);
+                       parm.sched_priority=sched_get_priority_max(SCHED_OTHER);
+                                               
+                       if (pthread_setschedparam(pthread_self(), SCHED_OTHER, &parm)) {
+                               tX_error("loop(): failed to set non-realtime priority.");
+                       } else {
+                               tX_debug("loop(): set SCHED_OTHER.");
+                       }                       
+               }
+#endif         
                loop_is_active=true;
                pthread_mutex_unlock(&start);