This is a repost from a month or so back. This patch is critical
now that the old API is gone. :)
-aaron
Index: server/mpm/beos/beos.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
retrieving revision 1.93
diff -u -u -r1.93 beos.c
--- server/mpm/beos/beos.c 5 Apr 2002 02:23:02 -0000 1.93
+++ server/mpm/beos/beos.c 9 Apr 2002 15:25:35 -0000
@@ -68,6 +68,7 @@
#include "apr_strings.h"
#include "apr_portable.h"
+#include "apr_proc_mutex.h"
#include "httpd.h"
#include "http_main.h"
#include "http_log.h"
@@ -129,7 +130,7 @@
static int ap_thread_limit=0;
static int num_listening_sockets = 0;
static apr_socket_t ** listening_sockets;
-apr_lock_t *accept_mutex = NULL;
+apr_proc_mutex_t *accept_mutex = NULL;
static apr_pool_t *pconf; /* Pool for config stuff */
static apr_pool_t *pchild; /* Pool for httpd child stuff */
@@ -138,7 +139,7 @@
/* Keep track of the number of worker threads currently active */
static int worker_thread_count;
-apr_lock_t *worker_thread_count_mutex;
+apr_proc_mutex_t *worker_thread_count_mutex;
/* The structure used to pass unique initialization info to each thread */
typedef struct {
@@ -384,9 +385,9 @@
apr_pool_tag(ptrans, "transaction");
- apr_lock_acquire(worker_thread_count_mutex);
+ apr_proc_mutex_lock(worker_thread_count_mutex);
worker_thread_count++;
- apr_lock_release(worker_thread_count_mutex);
+ apr_proc_mutex_unlock(worker_thread_count_mutex);
(void) ap_update_child_status_from_indexes(0, child_slot, SERVER_STARTING,
(request_rec*)NULL);
@@ -410,7 +411,7 @@
(void) ap_update_child_status_from_indexes(0, child_slot, SERVER_READY,
(request_rec*)NULL);
- apr_lock_acquire(accept_mutex);
+ apr_proc_mutex_lock(accept_mutex);
while (!this_worker_should_exit) {
apr_int16_t event;
@@ -479,7 +480,7 @@
if (!this_worker_should_exit) {
rv = apr_accept(&csd, sd, ptrans);
- apr_lock_release(accept_mutex);
+ apr_proc_mutex_unlock(accept_mutex);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,
"apr_accept");
@@ -489,7 +490,7 @@
}
}
else {
- apr_lock_release(accept_mutex);
+ apr_proc_mutex_unlock(accept_mutex);
break;
}
apr_pool_clear(ptrans);
@@ -502,9 +503,9 @@
ap_log_error(APLOG_MARK, APLOG_NOTICE | APLOG_NOERRNO, 0, NULL,
"worker_thread %ld exiting", find_thread(NULL));
- apr_lock_acquire(worker_thread_count_mutex);
+ apr_proc_mutex_lock(worker_thread_count_mutex);
worker_thread_count--;
- apr_lock_release(worker_thread_count_mutex);
+ apr_proc_mutex_unlock(worker_thread_count_mutex);
return (0);
}
@@ -817,8 +818,8 @@
* used to lock around select so we only have one thread
* in select at a time
*/
- if ((rv = apr_lock_create(&accept_mutex, APR_MUTEX, APR_CROSS_PROCESS,
- APR_LOCK_DEFAULT, NULL, pconf)) != APR_SUCCESS) {
+ rv = apr_proc_mutex_create(&accept_mutex, NULL, APR_LOCK_DEFAULT, pconf);
+ if (rv != APR_SUCCESS) {
/* tsch tsch, can't have more than one thread in the accept loop
at a time so we need to fall on our sword... */
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
@@ -829,8 +830,9 @@
/* worker_thread_count_mutex
* locks the worker_thread_count so we have ana ccurate count...
*/
- if ((rv = apr_lock_create(&worker_thread_count_mutex, APR_MUTEX,
APR_CROSS_PROCESS,
- APR_LOCK_DEFAULT, NULL, pconf)) != APR_SUCCESS) {
+ rv = apr_proc_mutex_create(&worker_thread_count_mutex, NULL,
+ APR_LOCK_DEFAULT, pconf);
+ if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s,
"Couldn't create worker thread count lock");
return 1;
@@ -991,8 +993,8 @@
/* just before we go, tidy up the locks we've created to prevent a
* potential leak of semaphores... */
- apr_lock_destroy(worker_thread_count_mutex);
- apr_lock_destroy(accept_mutex);
+ apr_proc_mutex_destroy(worker_thread_count_mutex);
+ apr_proc_mutex_destroy(accept_mutex);
return 0;
}