Don't take threads with other priorities into account as changing the

2000-11-09  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* 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).
This commit is contained in:
Sebastian Wilhelmi 2000-11-09 12:28:12 +00:00 committed by Sebastian Wilhelmi
parent 14c4da8cdd
commit c46b9f34e4
10 changed files with 70 additions and 52 deletions

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -1,3 +1,11 @@
2000-11-09 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <hp@pobox.com>
* gmarkup.h: rename G_MARKUP_FOO to

View File

@ -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;

View File

@ -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;