[maemo-commits] [maemo-commits] r14983 - in projects/haf/trunk/glib: glib gthread

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Dec 19 13:51:07 EET 2007
Author: xan
Date: 2007-12-19 13:50:55 +0200 (Wed, 19 Dec 2007)
New Revision: 14983

Modified:
   projects/haf/trunk/glib/glib/gthread.c
   projects/haf/trunk/glib/glib/gthread.h
   projects/haf/trunk/glib/glib/gthreadpool.c
   projects/haf/trunk/glib/glib/gthreadpool.h
   projects/haf/trunk/glib/gthread/gthread-posix.c
Log:
Revert "Realtime scheduling support for GThreadPools."

This reverts commit eba235b9753f7d128590b478d772b15db94115ca.


Modified: projects/haf/trunk/glib/glib/gthread.c
===================================================================
--- projects/haf/trunk/glib/glib/gthread.c	2007-12-17 10:52:23 UTC (rev 14982)
+++ projects/haf/trunk/glib/glib/gthread.c	2007-12-19 11:50:55 UTC (rev 14983)
@@ -881,15 +881,6 @@
   g_static_mutex_free (&lock->mutex);
 }
 
-gboolean g_thread_set_scheduler (GThread         *thread,
-                                 GThreadScheduler scheduler,
-                                 gint             priority)
-{
-  GRealThread* real = (GRealThread*) thread;
-
-  return G_THREAD_CF(scheduler_set, 0, (&real->system_thread, scheduler, priority));
-}
-
 /**
  * g_thread_foreach
  * @thread_func: function to call for all GThread structures

Modified: projects/haf/trunk/glib/glib/gthread.h
===================================================================
--- projects/haf/trunk/glib/glib/gthread.h	2007-12-17 10:52:23 UTC (rev 14982)
+++ projects/haf/trunk/glib/glib/gthread.h	2007-12-19 11:50:55 UTC (rev 14983)
@@ -1,8 +1,6 @@
 /* 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,13 +54,6 @@
   G_THREAD_PRIORITY_URGENT
 } GThreadPriority;
 
-typedef enum
-{
-  G_THREAD_SCHEDULER_DEFAULT,
-  G_THREAD_SCHEDULER_FIFO,
-  G_THREAD_SCHEDULER_RR
-} GThreadScheduler;
-
 typedef struct _GThread         GThread;
 struct  _GThread
 {
@@ -115,11 +106,6 @@
   void      (*thread_self)        (gpointer              thread);
   gboolean  (*thread_equal)       (gpointer              thread1,
 				   gpointer              thread2);
-  gint      (*priority_min)       (GThreadScheduler      scheduler);
-  gint      (*priority_max)       (GThreadScheduler      scheduler);
-  gboolean  (*scheduler_set)      (gpointer              thread,
-                                   GThreadScheduler      scheduler,
-                                   gint                  priority);
 };
 
 GLIB_VAR GThreadFunctions       g_thread_functions_for_glib_use;
@@ -218,13 +204,6 @@
                                                        (private_key, value))
 #define g_thread_yield()              G_THREAD_CF (thread_yield, (void)0, ())
 
-#define g_thread_scheduler_get_priority_min(sched) G_THREAD_CF (priority_min, \
-                                                            0, \
-                                                            (sched))
-#define g_thread_scheduler_get_priority_max(sched) G_THREAD_CF (priority_max, \
-                                                            0, \
-                                                            (sched))
-
 #define g_thread_create(func, data, joinable, error)			\
   (g_thread_create_full (func, data, 0, joinable, FALSE, 		\
                          G_THREAD_PRIORITY_NORMAL, error))
@@ -242,9 +221,6 @@
 
 void     g_thread_set_priority (GThread               *thread,
                                 GThreadPriority        priority);
-gboolean g_thread_set_scheduler (GThread              *thread,
-                                 GThreadScheduler      scheduler,
-                                 gint                  priority);
 
 /* GStaticMutexes can be statically initialized with the value
  * G_STATIC_MUTEX_INIT, and then they can directly be used, that is

Modified: projects/haf/trunk/glib/glib/gthreadpool.c
===================================================================
--- projects/haf/trunk/glib/glib/gthreadpool.c	2007-12-17 10:52:23 UTC (rev 14982)
+++ projects/haf/trunk/glib/glib/gthreadpool.c	2007-12-19 11:50:55 UTC (rev 14983)
@@ -4,8 +4,6 @@
  * 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
@@ -48,8 +46,6 @@
   gboolean waiting;
   GCompareDataFunc sort_func;
   gpointer sort_user_data;
-  GThreadScheduler scheduler;
-  gint priority;
 };
 
 /* The following is just an address to mark the wakeup order for a
@@ -249,15 +245,6 @@
   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 == 0))
-    {
-      if (!g_thread_set_scheduler(g_thread_self(), pool->scheduler, pool->priority))
-        g_warning("g_thread_set_scheduler() failed for pool %p", pool);
-    }
-
   g_async_queue_lock (pool->queue);
 
   while (TRUE)
@@ -433,20 +420,6 @@
 		   gboolean         exclusive,
 		   GError         **error)
 {
-  return g_thread_pool_new_with_priority(func, user_data, max_threads,
-                                         exclusive, G_THREAD_SCHEDULER_DEFAULT,
-                                         0, error);
-}
-
-GThreadPool* 
-g_thread_pool_new_with_priority (GFunc            func,
-                                 gpointer         user_data,
-                                 gint             max_threads,
-                                 gboolean         exclusive,
-                                 GThreadScheduler scheduler,
-                                 gint             priority,
-                                 GError         **error)
-{
   GRealThreadPool *retval;
   G_LOCK_DEFINE_STATIC (init);
 
@@ -465,8 +438,6 @@
   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;
 

Modified: projects/haf/trunk/glib/glib/gthreadpool.h
===================================================================
--- projects/haf/trunk/glib/glib/gthreadpool.h	2007-12-17 10:52:23 UTC (rev 14982)
+++ projects/haf/trunk/glib/glib/gthreadpool.h	2007-12-19 11:50:55 UTC (rev 14983)
@@ -1,8 +1,6 @@
 /* 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
@@ -58,14 +56,6 @@
                                                gboolean         exclusive,
                                                GError         **error);
 
-GThreadPool*    g_thread_pool_new_with_priority (GFunc            func,
-                                                 gpointer         user_data,
-                                                 gint             max_threads,
-                                                 gboolean         exclusive,
-                                                 GThreadScheduler scheduler,
-                                                 gint             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

Modified: projects/haf/trunk/glib/gthread/gthread-posix.c
===================================================================
--- projects/haf/trunk/glib/gthread/gthread-posix.c	2007-12-17 10:52:23 UTC (rev 14982)
+++ projects/haf/trunk/glib/gthread/gthread-posix.c	2007-12-19 11:50:55 UTC (rev 14983)
@@ -4,8 +4,6 @@
  * 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
@@ -443,61 +441,6 @@
   return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
 }
 
-gint g_thread_scheduler_priority_min_posix_impl (GThreadScheduler scheduler)
-{
-  switch (scheduler)
-  {
-    case G_THREAD_SCHEDULER_DEFAULT:
-      return sched_get_priority_min(SCHED_OTHER);
-    case G_THREAD_SCHEDULER_FIFO:
-      return sched_get_priority_min(SCHED_FIFO);
-    case G_THREAD_SCHEDULER_RR:
-      return sched_get_priority_min(SCHED_RR);
-    default:
-      return 0;
-  }
-}
-
-gint g_thread_scheduler_priority_max_posix_impl (GThreadScheduler scheduler)
-{
-  switch (scheduler)
-  {
-    case G_THREAD_SCHEDULER_DEFAULT:
-      return sched_get_priority_max(SCHED_OTHER);
-    case G_THREAD_SCHEDULER_FIFO:
-      return sched_get_priority_max(SCHED_FIFO);
-    case G_THREAD_SCHEDULER_RR:
-      return sched_get_priority_max(SCHED_RR);
-    default:
-      return 0;
-  }
-}
-
-gboolean g_thread_scheduler_set_posix_impl (gpointer         thread,
-		                            GThreadScheduler scheduler,
-                                            gint             priority)
-{
-  int schedpol;
-  struct sched_param schedprio;
-
-  switch (scheduler)
-  {
-    case G_THREAD_SCHEDULER_FIFO:
-      schedpol = SCHED_FIFO;
-      break;
-    case G_THREAD_SCHEDULER_RR:
-      schedpol = SCHED_RR;
-      break;
-    case G_THREAD_SCHEDULER_DEFAULT:
-    default:
-      schedpol = SCHED_OTHER;
-  }
-  schedprio.sched_priority = priority;
-  if (pthread_setschedparam(*(pthread_t *) thread, schedpol, &schedprio))
-    return FALSE;
-  return TRUE;
-}
-
 #ifdef USE_CLOCK_GETTIME 
 static guint64
 gettime (void)
@@ -535,8 +478,5 @@
   g_thread_exit_posix_impl,
   g_thread_set_priority_posix_impl,
   g_thread_self_posix_impl,
-  g_thread_equal_posix_impl,
-  g_thread_scheduler_priority_min_posix_impl,
-  g_thread_scheduler_priority_max_posix_impl,
-  g_thread_scheduler_set_posix_impl
+  g_thread_equal_posix_impl
 };


More information about the maemo-commits mailing list