From c46b9f34e4ac5f0b869fe6077973336d5e1cead8 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Thu, 9 Nov 2000 12:28:12 +0000 Subject: [PATCH] Don't take threads with other priorities into account as changing the 2000-11-09 Sebastian Wilhelmi * gthreadpool.c: Don't take threads with other priorities into account as changing the priority is highly unportable. (Actually using it at all already is unportable, but even sometimes where that works, changing priority is not possible). --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-0 | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-12 | 8 ++++++++ ChangeLog.pre-2-2 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ glib/gthreadpool.c | 29 +++-------------------------- gthreadpool.c | 29 +++-------------------------- 10 files changed, 70 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index dec95dba0..57964146d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index dec95dba0..57964146d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2000-11-09 Sebastian Wilhelmi + + * gthreadpool.c: Don't take other threads with other priorities + into account as changing the priority is highly + unportable. (Actually using it at all already is unportable, but + even sometimes where that works, changing priority is not + possible). + 2000-11-05 Havoc Pennington * gmarkup.h: rename G_MARKUP_FOO to diff --git a/glib/gthreadpool.c b/glib/gthreadpool.c index d1a4d2c24..1d8422949 100644 --- a/glib/gthreadpool.c +++ b/glib/gthreadpool.c @@ -151,9 +151,6 @@ g_thread_pool_thread_proxy (gpointer data) g_async_queue_lock (pool->queue); - if (pool->pool.priority != self->priority) - g_thread_set_priority (self, pool->pool.priority); - /* pool->num_threads++ is not done here, but in * g_thread_pool_start_thread to make the new started thread * known to the pool, before itself can do it. */ @@ -184,28 +181,9 @@ g_thread_pool_start_thread (GRealThreadPool *pool, g_async_queue_unlock (queue); - if (!success) - { - /* Now we search for threads with other priorities too, but - * only, when there is more than one unused thread with that - * priority. */ - GThreadPriority priority; - for (priority = G_THREAD_PRIORITY_LOW; - priority < G_THREAD_PRIORITY_URGENT + 1; priority++) - { - queue = unused_thread_queue[priority]; - g_async_queue_lock (queue); - - if (g_async_queue_length_unlocked (queue) < -1) - { - g_async_queue_push_unlocked (queue, pool); - success = TRUE; - } - - g_async_queue_unlock (queue); - } - } - + /* We will not search for threads with other priorities, because changing + * priority is quite unportable */ + if (!success) { GError *local_error = NULL; @@ -251,7 +229,6 @@ g_thread_pool_new (GFunc thread_func, retval->pool.priority = priority; retval->pool.exclusive = exclusive; retval->pool.user_data = user_data; - retval->queue = g_async_queue_new (); retval->max_threads = max_threads; retval->num_threads = 0; diff --git a/gthreadpool.c b/gthreadpool.c index d1a4d2c24..1d8422949 100644 --- a/gthreadpool.c +++ b/gthreadpool.c @@ -151,9 +151,6 @@ g_thread_pool_thread_proxy (gpointer data) g_async_queue_lock (pool->queue); - if (pool->pool.priority != self->priority) - g_thread_set_priority (self, pool->pool.priority); - /* pool->num_threads++ is not done here, but in * g_thread_pool_start_thread to make the new started thread * known to the pool, before itself can do it. */ @@ -184,28 +181,9 @@ g_thread_pool_start_thread (GRealThreadPool *pool, g_async_queue_unlock (queue); - if (!success) - { - /* Now we search for threads with other priorities too, but - * only, when there is more than one unused thread with that - * priority. */ - GThreadPriority priority; - for (priority = G_THREAD_PRIORITY_LOW; - priority < G_THREAD_PRIORITY_URGENT + 1; priority++) - { - queue = unused_thread_queue[priority]; - g_async_queue_lock (queue); - - if (g_async_queue_length_unlocked (queue) < -1) - { - g_async_queue_push_unlocked (queue, pool); - success = TRUE; - } - - g_async_queue_unlock (queue); - } - } - + /* We will not search for threads with other priorities, because changing + * priority is quite unportable */ + if (!success) { GError *local_error = NULL; @@ -251,7 +229,6 @@ g_thread_pool_new (GFunc thread_func, retval->pool.priority = priority; retval->pool.exclusive = exclusive; retval->pool.user_data = user_data; - retval->queue = g_async_queue_new (); retval->max_threads = max_threads; retval->num_threads = 0;