apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@ebuilt.com>
Subject Re: [PATCH] APR thread updates and associated httpd-2.0 changes
Date Mon, 23 Jul 2001 06:26:39 GMT
On Fri, Jul 20, 2001 at 11:52:36PM -0700, Aaron Bannert wrote:
> [Still trying to get the hang of this whole patch-submission/OSS project/
> mailing list thing :) -- this patch should be *much* smaller]
> 
> 
> Update to APR thread API to explicitly pass the apr_thread_t to the
> worker function.
> 
> Changed the worker routine's signature to take a single parameter:
> apr_thread_param_t, which contains the opaque data and the apr_thread_t.
> 
> httpd-2.0 will have to be updated after applying this patch to APR.

And here are the updates to httpd-2.0 mentioned above:

Changes the threaded MPM and the perchild MPM to work with the
new-and-improved APR thread API. All it really does it pull the
"data" parameter from the new apr_thread_param_t struct.

-aaron



Index: server/mpm/perchild/perchild.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/perchild/perchild.c,v
retrieving revision 1.71
diff -u -r1.71 perchild.c
--- server/mpm/perchild/perchild.c	2001/07/18 20:45:35	1.71
+++ server/mpm/perchild/perchild.c	2001/07/23 06:20:20
@@ -512,7 +512,7 @@
     }
 }
 
-static void *worker_thread(void *);
+static void *worker_thread(apr_thread_param_t *);
 
 /* Starts a thread as long as we're below max_threads */
 static int start_thread(void)
@@ -579,8 +579,9 @@
 
 /* idle_thread_count should be incremented before starting a worker_thread */
 
-static void *worker_thread(void *arg)
+static void *worker_thread(apr_thread_param_t *param)
 {
+    apr_thread_t *thread = param->t;
     apr_socket_t *csd = NULL;
     apr_pool_t *tpool;		/* Pool for this thread           */
     apr_pool_t *ptrans;		/* Pool for per-transaction stuff */
@@ -588,7 +589,7 @@
     int srv;
     int curr_pollfd, last_pollfd = 0;
     int thread_just_started = 1;
-    int thread_num = *((int *) arg);
+    int thread_num = *((int *) param->data);
     long conn_id = child_num * HARD_THREAD_LIMIT + thread_num;
     apr_pollfd_t *pollset;
     int n;
Index: server/mpm/threaded/threaded.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/threaded/threaded.c,v
retrieving revision 1.46
diff -u -r1.46 threaded.c
--- server/mpm/threaded/threaded.c	2001/07/18 20:45:36	1.46
+++ server/mpm/threaded/threaded.c	2001/07/23 06:20:21
@@ -520,9 +520,10 @@
     apr_lock_release(pipe_of_death_mutex);
 }
 
-static void * worker_thread(void * dummy)
+static void * worker_thread(apr_thread_param_t *param)
 {
-    proc_info * ti = dummy;
+    apr_thread_t *thread = param->t;
+    proc_info * ti = param->data;
     int process_slot = ti->pid;
     int thread_slot = ti->tid;
     apr_pool_t *tpool = ti->tpool;
@@ -671,9 +672,10 @@
     return 0;
 }
 
-static void *start_threads(void * dummy)
+static void *start_threads(apr_thread_param_t *param)
 {
-    thread_starter *ts = dummy;
+    apr_thread_t *thread = param->t;
+    thread_starter *ts = param->data;
     apr_thread_t **threads = ts->threads;
     apr_threadattr_t *thread_attr = ts->threadattr;
     int child_num_arg = ts->child_num_arg;


Mime
View raw message