[glib] Add max_threads argument to g_threaded_socket_service_new



commit 13cb01176291a8baa171da8dcb9f679b274af450
Author: Alexander Larsson <alexl redhat com>
Date:   Mon May 18 08:47:10 2009 +0200

    Add max_threads argument to g_threaded_socket_service_new
---
 gio/gthreadedsocketservice.c |    4 +++-
 gio/gthreadedsocketservice.h |    2 +-
 gio/tests/echo-server.c      |    2 +-
 gio/tests/httpd.c            |    2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gio/gthreadedsocketservice.c b/gio/gthreadedsocketservice.c
index 182d1b1..68e0061 100644
--- a/gio/gthreadedsocketservice.c
+++ b/gio/gthreadedsocketservice.c
@@ -201,12 +201,14 @@ g_threaded_socket_service_class_init (GThreadedSocketServiceClass *class)
 /**
  * g_threaded_socket_service_new:
  * @returns: a new #GSocketService.
+ * @max_threads: the maximal number of threads to execute concurrently
+ *   handling incomming clients, -1 means no limit
  *
  * Creates a new #GThreadedSocketService with no listeners.  Listeners
  * must be added with g_socket_service_add_listeners().
  **/
 GSocketService *
-g_threaded_socket_service_new (void)
+g_threaded_socket_service_new (int max_threads)
 {
   return g_object_new (G_TYPE_THREADED_SOCKET_SERVICE, NULL);
 }
diff --git a/gio/gthreadedsocketservice.h b/gio/gthreadedsocketservice.h
index 209f83c..f947090 100644
--- a/gio/gthreadedsocketservice.h
+++ b/gio/gthreadedsocketservice.h
@@ -74,7 +74,7 @@ struct _GThreadedSocketService
 };
 
 GType                   g_threaded_socket_service_get_type              (void);
-GSocketService *        g_threaded_socket_service_new                   (void);
+GSocketService *        g_threaded_socket_service_new                   (int max_threads);
 
 G_END_DECLS
 
diff --git a/gio/tests/echo-server.c b/gio/tests/echo-server.c
index 1aa3166..7e05510 100644
--- a/gio/tests/echo-server.c
+++ b/gio/tests/echo-server.c
@@ -53,7 +53,7 @@ main (int argc, char *argv[])
       return 1;
     }
 
-  service = g_threaded_socket_service_new ();
+  service = g_threaded_socket_service_new (10);
 
   if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service),
 					port,
diff --git a/gio/tests/httpd.c b/gio/tests/httpd.c
index 6ad0b43..25a2454 100644
--- a/gio/tests/httpd.c
+++ b/gio/tests/httpd.c
@@ -164,7 +164,7 @@ main (int argc, char *argv[])
 
   root = g_strdup (argv[1]);
 
-  service = g_threaded_socket_service_new ();
+  service = g_threaded_socket_service_new (10);
   if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service),
 					port,
 					NULL,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]