? compile
? gnome-vfs-zip
? imported/fnmatch/Makefile
? imported/fnmatch/Makefile.in
? imported/neon/Makefile
? imported/neon/Makefile.in
? test/.test-async.c.swp
? test/test-parse-ls-lga
Index: libgnomevfs/Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/Makefile.am,v
retrieving revision 1.143
diff -u -p -r1.143 Makefile.am
--- libgnomevfs/Makefile.am	22 Nov 2005 14:34:09 -0000	1.143
+++ libgnomevfs/Makefile.am	1 Dec 2005 18:43:02 -0000
@@ -169,7 +169,6 @@ noinst_HEADERS =				\
 	gnome-vfs-private-utils.h		\
 	gnome-vfs-private.h			\
 	gnome-vfs-ssl-private.h			\
-	gnome-vfs-thread-pool.h			\
 	gnome-vfs-unix-mounts.h 		\
 	gnome-vfs-volume-monitor-client.h	\
 	gnome-vfs-volume-monitor-daemon.h	\
@@ -310,7 +309,6 @@ libgnomevfs_2_la_SOURCES =			\
 	gnome-vfs-socket-buffer.c		\
 	gnome-vfs-socket.c			\
 	gnome-vfs-ssl.c				\
-	gnome-vfs-thread-pool.c			\
 	gnome-vfs-transform.c			\
 	gnome-vfs-uri.c				\
 	gnome-vfs-utils.c			\
Index: libgnomevfs/gnome-vfs-init.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-init.c,v
retrieving revision 1.38
diff -u -p -r1.38 gnome-vfs-init.c
--- libgnomevfs/gnome-vfs-init.c	14 Nov 2005 11:41:13 -0000	1.38
+++ libgnomevfs/gnome-vfs-init.c	1 Dec 2005 18:43:02 -0000
@@ -34,7 +34,6 @@
 #include "gnome-vfs-private-utils.h"
 
 #include "gnome-vfs-async-job-map.h"
-#include "gnome-vfs-thread-pool.h"
 #include "gnome-vfs-job-queue.h"
 #include "gnome-vfs-volume-monitor-private.h"
 
@@ -89,7 +88,7 @@ gnome_vfs_thread_init (void)
 	_gnome_vfs_module_callback_private_init ();
 	
 	_gnome_vfs_async_job_map_init ();
-	_gnome_vfs_thread_pool_init ();
+	_gnome_vfs_job_slave_init ();
 	_gnome_vfs_job_queue_init ();
 }
 
Index: libgnomevfs/gnome-vfs-job-queue.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-job-queue.c,v
retrieving revision 1.8
diff -u -p -r1.8 gnome-vfs-job-queue.c
--- libgnomevfs/gnome-vfs-job-queue.c	14 Nov 2005 11:41:13 -0000	1.8
+++ libgnomevfs/gnome-vfs-job-queue.c	1 Dec 2005 18:43:03 -0000
@@ -342,6 +342,8 @@ gnome_vfs_async_set_job_limit (int limit
 	max_decrease = (float)thread_count_limit - LIMIT_FUNCTION_LOWER_BOUND;
 	Q_DEBUG (("changing the thread count limit to %d\n", limit));
 	g_static_mutex_unlock (&job_queue_lock);
+
+	_gnome_vfs_job_slave_set_max_unused_slaves (limit);
 }
 
 /**
Index: libgnomevfs/gnome-vfs-job-slave.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-job-slave.c,v
retrieving revision 1.27
diff -u -p -r1.27 gnome-vfs-job-slave.c
--- libgnomevfs/gnome-vfs-job-slave.c	14 Apr 2005 18:48:29 -0000	1.27
+++ libgnomevfs/gnome-vfs-job-slave.c	1 Dec 2005 18:43:03 -0000
@@ -25,17 +25,18 @@
 #include "gnome-vfs-job-slave.h"
 
 #include "gnome-vfs-async-job-map.h"
-#include "gnome-vfs-thread-pool.h"
 #include "gnome-vfs-job-queue.h"
+#include "gnome-vfs-job-limit.h"
 #include <glib/gmessages.h>
 #include <unistd.h>
 
 static volatile gboolean gnome_vfs_quitting = FALSE;
 static volatile gboolean gnome_vfs_done_quitting = FALSE;
 
+static GThreadPool *thread_pool = NULL;
 
-static void *
-thread_routine (void *data)
+static void
+thread_routine (gpointer data, gpointer user_data)
 {
 	guint id;
 	GnomeVFSJob *job;
@@ -54,7 +55,7 @@ thread_routine (void *data)
 	if (job == NULL) {
 		JOB_DEBUG (("job already dead, bail %u", id));
 		_gnome_vfs_async_job_map_unlock ();
-		return NULL;
+		return;
 	}
 	
 	JOB_DEBUG (("locking job_lock %u", id));
@@ -75,12 +76,17 @@ thread_routine (void *data)
 		_gnome_vfs_async_job_map_unlock ();
 	}
 
-	return NULL;
+	/* We're finished with this job so run the job queue scheduler 
+	  * to start a new job if the queue is not empty
+	  */
+	_gnome_vfs_job_queue_run ();	
 }
 
 gboolean
 _gnome_vfs_job_create_slave (GnomeVFSJob *job)
 {
+	GError *err = NULL;
+	
 	g_return_val_if_fail (job != NULL, FALSE);
 
 	if (gnome_vfs_quitting) {
@@ -96,19 +102,48 @@ _gnome_vfs_job_create_slave (GnomeVFSJob
 		return FALSE;
 	}
 	
-	if (_gnome_vfs_thread_create (thread_routine, job->job_handle) != 0) {
-		g_warning ("Impossible to allocate a new GnomeVFSJob thread.");
+	g_thread_pool_push (thread_pool, job->job_handle, &err);
+
+	if (err != NULL) {
+
+		g_warning ("Impossible to allocate a new GnomeVFSJob thread (%s).",
+			   err->message);
+
+		g_error_free (err);
 		
 		/* thread did not start up, remove the job from the hash table */
 		_gnome_vfs_async_job_completed (job->job_handle);
 		_gnome_vfs_job_destroy (job);
 		return FALSE;
 	}
-
+	
 	return TRUE;
 }
 
 void
+_gnome_vfs_job_slave_init (void)
+{
+	int max_threads;
+	
+	thread_pool = g_thread_pool_new (thread_routine,
+					 NULL,
+					 -1,
+					 FALSE,
+					 NULL);
+
+	max_threads = gnome_vfs_async_get_job_limit ();
+	g_thread_pool_set_max_unused_threads (max_threads);
+}
+
+
+void
+_gnome_vfs_job_slave_set_max_unused_slaves (int max_slaves)
+{
+	g_thread_pool_set_max_unused_threads (max_slaves);
+}
+
+
+void
 _gnome_vfs_thread_backend_shutdown (void)
 {
 	gboolean done;
@@ -144,6 +179,6 @@ _gnome_vfs_thread_backend_shutdown (void
 		g_usleep (20000);
 	}
 
-	_gnome_vfs_thread_pool_shutdown ();
+	g_thread_pool_free (thread_pool, TRUE, FALSE);
 	_gnome_vfs_async_job_map_shutdown ();
 }
Index: libgnomevfs/gnome-vfs-job-slave.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-job-slave.h,v
retrieving revision 1.5
diff -u -p -r1.5 gnome-vfs-job-slave.h
--- libgnomevfs/gnome-vfs-job-slave.h	19 Dec 2002 17:57:19 -0000	1.5
+++ libgnomevfs/gnome-vfs-job-slave.h	1 Dec 2005 18:43:03 -0000
@@ -26,11 +26,13 @@
 
 #include "gnome-vfs-job.h"
 
-gboolean _gnome_vfs_job_create_slave        (GnomeVFSJob *job);
 
+void     _gnome_vfs_job_slave_init                  (void) G_GNUC_INTERNAL;
+gboolean _gnome_vfs_job_create_slave                (GnomeVFSJob *job) G_GNUC_INTERNAL;
+void     _gnome_vfs_job_slave_set_max_unused_slaves (int max_slaves) G_GNUC_INTERNAL;
 /* Call this before taking down the idle task in the master thread to
  * give pending slave threads a chance to finish cleanly.
  */
-void     _gnome_vfs_thread_backend_shutdown (void);
+void     _gnome_vfs_thread_backend_shutdown (void) G_GNUC_INTERNAL;
 
 #endif /* GNOME_VFS_JOB_SLAVE_H */
Index: libgnomevfs/gnome-vfs-pthread.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-pthread.c,v
retrieving revision 1.5
diff -u -p -r1.5 gnome-vfs-pthread.c
--- libgnomevfs/gnome-vfs-pthread.c	19 Dec 2002 17:57:19 -0000	1.5
+++ libgnomevfs/gnome-vfs-pthread.c	1 Dec 2005 18:43:03 -0000
@@ -2,6 +2,7 @@
 #include "gnome-vfs-async-job-map.h"
 #include "gnome-vfs-thread-pool.h"
 #include "gnome-vfs-job-queue.h"
+#include "gnome-vfs-job-slave.h"
 
 gboolean
 gnome_vfs_pthread_init (gboolean init_deps)
@@ -11,7 +12,7 @@ gnome_vfs_pthread_init (gboolean init_de
 	}
 	
 	_gnome_vfs_async_job_map_init ();
-	_gnome_vfs_thread_pool_init ();
+	_gnome_vfs_job_slave_init ();
 	_gnome_vfs_job_queue_init ();
 	return TRUE;
 }
