Re: [AD] [AL] More SGI weirdness, and XVideo

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Patches for IRIX detection.

The patch for modifying the scheduling policy under IRIX is attached.
It mimics the policy under QNX:
- primary thread: 0 relative priority,
- background event thread: +2,
- timer thread: +4.

-- 
Eric Botcazou
diff -u /home/eric/cvs/allegro/src/unix/uptimer.c allegro/src/unix/uptimer.c
--- /home/eric/cvs/allegro/src/unix/uptimer.c	Wed Jan 23 23:25:34 2002
+++ allegro/src/unix/uptimer.c	Thu Dec 19 09:00:39 2002
@@ -119,6 +119,19 @@
    }
 #endif
 
+   /* thread priority adjustment for IRIX:
+    *  The timer thread is set to the highest relative priority.
+    */
+   if (os_type == OSTYPE_IRIX) {
+      struct sched_param sparam;
+      int spolicy;
+   
+      if (pthread_getschedparam(pthread_self(), &spolicy, &sparam) == 0) {
+         sparam.sched_priority += 4;
+         pthread_setschedparam(pthread_self(), spolicy, &sparam);
+      }
+   }
+
    gettimeofday(&old_time, 0);
 
    while (thread_alive) {
diff -u /home/eric/cvs/allegro/src/unix/uthreads.c allegro/src/unix/uthreads.c
--- /home/eric/cvs/allegro/src/unix/uthreads.c	Thu Dec  5 18:58:31 2002
+++ allegro/src/unix/uthreads.c	Thu Dec 19 09:01:51 2002
@@ -55,6 +55,19 @@
 
 	block_all_signals();
 
+	/* thread priority adjustment for IRIX:
+	 *  The background thread is set to the medium relative priority.
+	 */
+	if (os_type == OSTYPE_IRIX) {
+		struct sched_param sparam;
+		int spolicy;
+   
+		if (pthread_getschedparam(pthread_self(), &spolicy, &sparam) == 0) {
+			sparam.sched_priority += 2;
+			pthread_setschedparam(pthread_self(), spolicy, &sparam);
+		}
+	}
+
 	gettimeofday (&old_time, 0);
 
 	while (1) {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/