diff -ur glib-2.14.4.orig/glib/gthread.c glib-2.14.4.rt/glib/gthread.c
--- glib-2.14.4.orig/glib/gthread.c	2007-11-24 08:40:59.000000000 +0200
+++ glib-2.14.4.rt/glib/gthread.c	2008-01-14 17:33:14.000000000 +0200
@@ -638,13 +638,14 @@
 }
 
 GThread*
-g_thread_create_full (GThreadFunc 		 func,
+g_thread_create_full (GThreadFunc	 func,
 		      gpointer 		 data,
 		      gulong 		 stack_size,
 		      gboolean 		 joinable,
 		      gboolean 		 bound,
 		      GThreadPriority 	 priority,
-		      GError                **error)
+		      GError             **error,
+		      GThreadScheduler   scheduler)
 {
   GRealThread* result;
   GError *local_error = NULL;
@@ -662,7 +663,8 @@
   G_LOCK (g_thread);
   G_THREAD_UF (thread_create, (g_thread_create_proxy, result,
 			       stack_size, joinable, bound, priority,
-			       &result->system_thread, &local_error));
+			       &result->system_thread, &local_error,
+			       scheduler));
   if (!local_error)
     {
       result->next = g_thread_all_threads;
@@ -733,7 +735,8 @@
 
 void
 g_thread_set_priority (GThread* thread,
-		       GThreadPriority priority)
+		       GThreadPriority priority,
+		       GThreadScheduler scheduler)
 {
   GRealThread* real = (GRealThread*) thread;
 
@@ -745,7 +748,7 @@
   thread->priority = priority;
 
   G_THREAD_CF (thread_set_priority, (void)0,
-	       (&real->system_thread, priority));
+	       (&real->system_thread, priority, scheduler));
 }
 
 GThread*
diff -ur glib-2.14.4.orig/glib/gthread.h glib-2.14.4.rt/glib/gthread.h
--- glib-2.14.4.orig/glib/gthread.h	2007-11-24 08:40:59.000000000 +0200
+++ glib-2.14.4.rt/glib/gthread.h	2008-01-14 17:35:57.000000000 +0200
@@ -1,6 +1,8 @@
 /* GLIB - Library of useful routines for C programming
  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  *
+ * Copyright (C) 2007 Nokia Corporation
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -55,6 +57,14 @@
   G_THREAD_PRIORITY_URGENT
 } GThreadPriority;
 
+#define G_THREAD_SCHED_MAGIC		0xf83f0000
+typedef enum
+{
+  G_THREAD_SCHEDULER_DEFAULT = (G_THREAD_SCHED_MAGIC + 1),
+  G_THREAD_SCHEDULER_FIFO = (G_THREAD_SCHED_MAGIC + 2),
+  G_THREAD_SCHEDULER_RR = (G_THREAD_SCHED_MAGIC + 3)
+} GThreadScheduler;
+
 typedef struct _GThread         GThread;
 struct  _GThread
 {
@@ -98,12 +108,14 @@
                                    gboolean              bound,
                                    GThreadPriority       priority,
                                    gpointer              thread,
-                                   GError              **error);
+                                   GError              **error,
+				   GThreadScheduler      scheduler);
   void      (*thread_yield)       (void);
   void      (*thread_join)        (gpointer              thread);
   void      (*thread_exit)        (void);
   void      (*thread_set_priority)(gpointer              thread,
-                                   GThreadPriority       priority);
+                                   GThreadPriority       priority,
+				   GThreadScheduler      scheduler);
   void      (*thread_self)        (gpointer              thread);
   gboolean  (*thread_equal)       (gpointer              thread1,
 				   gpointer              thread2);
@@ -207,7 +219,8 @@
 
 #define g_thread_create(func, data, joinable, error)			\
   (g_thread_create_full (func, data, 0, joinable, FALSE, 		\
-                         G_THREAD_PRIORITY_NORMAL, error))
+                         G_THREAD_PRIORITY_NORMAL, error,               \
+			 G_THREAD_SCHEDULER_DEFAULT))
 
 GThread* g_thread_create_full  (GThreadFunc            func,
                                 gpointer               data,
@@ -215,13 +228,15 @@
                                 gboolean               joinable,
                                 gboolean               bound,
                                 GThreadPriority        priority,
-                                GError               **error);
+                                GError               **error,
+				GThreadScheduler       scheduler);
 GThread* g_thread_self         (void);
 void     g_thread_exit         (gpointer               retval);
 gpointer g_thread_join         (GThread               *thread);
 
 void     g_thread_set_priority (GThread               *thread,
-                                GThreadPriority        priority);
+                                GThreadPriority        priority,
+				GThreadScheduler       scheduler);
 
 /* GStaticMutexes can be statically initialized with the value
  * G_STATIC_MUTEX_INIT, and then they can directly be used, that is
diff -ur glib-2.14.4.orig/glib/gthreadpool.c glib-2.14.4.rt/glib/gthreadpool.c
--- glib-2.14.4.orig/glib/gthreadpool.c	2007-11-24 08:40:59.000000000 +0200
+++ glib-2.14.4.rt/glib/gthreadpool.c	2008-01-14 16:39:10.000000000 +0200
@@ -4,6 +4,8 @@
  * GAsyncQueue: thread pool implementation.
  * Copyright (C) 2000 Sebastian Wilhelmi; University of Karlsruhe
  *
+ * Copyright (C) 2007 Nokia Corporation
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -46,6 +48,8 @@
   gboolean waiting;
   GCompareDataFunc sort_func;
   gpointer sort_user_data;
+  GThreadScheduler scheduler;
+  GThreadPriority priority;
 };
 
 /* The following is just an address to mark the wakeup order for a
@@ -245,6 +249,14 @@
   DEBUG_MSG (("thread %p started for pool %p.", 
 	      g_thread_self (), pool));
 
+  /* thread self-modifies the scheduler and priority
+   */
+  if (!(pool->scheduler == G_THREAD_SCHEDULER_DEFAULT &&
+        pool->priority == G_THREAD_PRIORITY_NORMAL))
+    {
+      g_thread_set_priority(g_thread_self(), pool->priority, pool->scheduler);
+    }
+
   g_async_queue_lock (pool->queue);
 
   while (TRUE)
@@ -420,6 +432,20 @@
 		   gboolean         exclusive,
 		   GError         **error)
 {
+  return g_thread_pool_new_with_priority(func, user_data, max_threads,
+                                         exclusive, G_THREAD_SCHEDULER_DEFAULT,
+                                         G_THREAD_PRIORITY_NORMAL, error);
+}
+
+GThreadPool* 
+g_thread_pool_new_with_priority (GFunc            func,
+                                 gpointer         user_data,
+                                 gint             max_threads,
+                                 gboolean         exclusive,
+                                 GThreadScheduler scheduler,
+                                 GThreadPriority  priority,
+                                 GError         **error)
+{
   GRealThreadPool *retval;
   G_LOCK_DEFINE_STATIC (init);
 
@@ -438,6 +464,8 @@
   retval->max_threads = max_threads;
   retval->num_threads = 0;
   retval->running = TRUE;
+  retval->scheduler = scheduler;
+  retval->priority = priority;
   retval->sort_func = NULL;
   retval->sort_user_data = NULL;
 
diff -ur glib-2.14.4.orig/glib/gthreadpool.h glib-2.14.4.rt/glib/gthreadpool.h
--- glib-2.14.4.orig/glib/gthreadpool.h	2007-11-24 08:40:59.000000000 +0200
+++ glib-2.14.4.rt/glib/gthreadpool.h	2008-01-14 16:29:45.000000000 +0200
@@ -1,6 +1,8 @@
 /* GLIB - Library of useful routines for C programming
  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
  *
+ * Copyright (C) 2007 Nokia Corporation
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -56,6 +58,14 @@
                                                gboolean         exclusive,
                                                GError         **error);
 
+GThreadPool*    g_thread_pool_new_with_priority (GFunc            func,
+                                                 gpointer         user_data,
+                                                 gint             max_threads,
+                                                 gboolean         exclusive,
+                                                 GThreadScheduler scheduler,
+                                                 GThreadPriority  priority,
+                                                 GError         **error);
+
 /* Push new data into the thread pool. This task is assigned to a thread later
  * (when the maximal number of threads is reached for that pool) or now
  * (otherwise). If necessary a new thread will be started. The function
diff -ur glib-2.14.4.orig/gthread/gthread-posix.c glib-2.14.4.rt/gthread/gthread-posix.c
--- glib-2.14.4.orig/gthread/gthread-posix.c	2007-11-24 08:41:02.000000000 +0200
+++ glib-2.14.4.rt/gthread/gthread-posix.c	2008-01-14 17:42:56.000000000 +0200
@@ -4,6 +4,8 @@
  * gthread.c: posix thread system implementation
  * Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
  *
+ * Copyright (C) 2007 Nokia Corporation
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -299,6 +301,35 @@
 }
 
 static void
+_g_thread_set_sched_param (int *policy,
+			   struct sched_param *sched,
+			   GThreadScheduler scheduler,
+			   GThreadPriority priority)
+{
+  int pprio;
+
+  switch (scheduler) {
+    case G_THREAD_SCHEDULER_DEFAULT:
+      *policy = SCHED_OTHER;
+      break;
+    case G_THREAD_SCHEDULER_FIFO:
+      *policy = SCHED_FIFO;
+      break;
+    case G_THREAD_SCHEDULER_RR:
+      *policy = SCHED_RR;
+      break;
+    default:
+      ;
+  }
+  pprio = g_thread_priority_map [priority];
+  if (pprio < sched_get_priority_min(*policy))
+    pprio = sched_get_priority_min(*policy);
+  else if (pprio > sched_get_priority_max(*policy))
+    pprio = sched_get_priority_max(*policy);
+  sched->sched_priority = pprio;
+}
+
+static void
 g_thread_create_posix_impl (GThreadFunc thread_func,
 			    gpointer arg,
 			    gulong stack_size,
@@ -306,7 +337,8 @@
 			    gboolean bound,
 			    GThreadPriority priority,
 			    gpointer thread,
-			    GError **error)
+			    GError **error,
+			    GThreadScheduler scheduler)
 {
   pthread_attr_t attr;
   gint ret;
@@ -342,9 +374,19 @@
 #ifdef HAVE_PRIORITIES
 # ifdef G_THREADS_IMPL_POSIX
   {
+    int policy;
     struct sched_param sched;
-    posix_check_cmd (pthread_attr_getschedparam (&attr, &sched));
-    sched.sched_priority = g_thread_priority_map [priority];
+    /* this would use the default values */
+    /*posix_check_cmd (pthread_attr_getschedpolicy(&attr, &policy));
+    posix_check_cmd (pthread_attr_getschedparam (&attr, &sched));*/
+    /* but we want to inherit...
+     * priority maps are initialized based on inheritance assumption anyway
+     * and that's where the problem comes from... */
+    posix_check_cmd (pthread_getschedparam (pthread_self(), &policy, &sched));
+    _g_thread_set_sched_param(&policy, &sched, scheduler, priority);
+    /*g_print("%s@%i: creating thread with policy %i, priority %i\n",
+      __FILE__, __LINE__, policy, sched.sched_priority);*/
+    posix_check_cmd_prio (pthread_attr_setschedpolicy (&attr, policy));
     posix_check_cmd_prio (pthread_attr_setschedparam (&attr, &sched));
   }
 # else /* G_THREADS_IMPL_DCE */
@@ -392,7 +434,8 @@
 }
 
 static void
-g_thread_set_priority_posix_impl (gpointer thread, GThreadPriority priority)
+g_thread_set_priority_posix_impl (gpointer thread, GThreadPriority priority,
+				  GThreadScheduler scheduler)
 {
   g_return_if_fail (priority >= G_THREAD_PRIORITY_LOW);
   g_return_if_fail (priority <= G_THREAD_PRIORITY_URGENT);
@@ -403,7 +446,7 @@
     int policy;
     posix_check_cmd (pthread_getschedparam (*(pthread_t*)thread, &policy,
 					    &sched));
-    sched.sched_priority = g_thread_priority_map [priority];
+    _g_thread_set_sched_param(&policy, &sched, scheduler, priority);
     posix_check_cmd_prio (pthread_setschedparam (*(pthread_t*)thread, policy,
 						 &sched));
   }
