httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-apr/pthreads/src/os/unix Makefile.tmpl multithread.c
Date Sun, 30 May 1999 23:49:02 GMT
manoj       99/05/30 16:49:02

  Modified:    pthreads/src/main Makefile.tmpl alloc.c scoreboard.c
               pthreads/src/modules/proxy Makefile.tmpl proxy_cache.c
                        proxy_util.c
               pthreads/src/modules/standard Makefile.tmpl mod_unique_id.c
               pthreads/src/os/unix Makefile.tmpl
  Removed:     pthreads/src/include multithread.h
               pthreads/src/os/unix multithread.c
  Log:
  More code cleanup. Get rid of multithread.[ch], so that we have one
  consistent scheme for using mutexes, and to simplify the switch to a
  portable runtime.
  
  Revision  Changes    Path
  1.9       +2 -2      apache-apr/pthreads/src/main/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/Makefile.tmpl,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- Makefile.tmpl	1999/04/17 03:35:54	1.8
  +++ Makefile.tmpl	1999/05/30 23:48:58	1.9
  @@ -72,7 +72,7 @@
    $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
    $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
    $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/apr.h \
  - $(INCDIR)/util_uri.h $(INCDIR)/multithread.h $(INCDIR)/http_log.h
  + $(INCDIR)/util_uri.h $(INCDIR)/http_log.h
   buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
    $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
    $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
  @@ -176,7 +176,7 @@
    $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/apr.h \
    $(INCDIR)/util_uri.h $(INCDIR)/http_log.h $(INCDIR)/http_main.h \
    $(INCDIR)/http_core.h $(INCDIR)/http_conf_globals.h \
  - $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h
  + $(INCDIR)/scoreboard.h
   util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
    $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
    $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
  
  
  
  1.6       +14 -17    apache-apr/pthreads/src/main/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/alloc.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- alloc.c	1999/04/09 03:43:28	1.5
  +++ alloc.c	1999/05/30 23:48:58	1.6
  @@ -63,10 +63,10 @@
    */
   
   #include "httpd.h"
  -#include "multithread.h"
   #include "http_log.h"
   
   #include <stdarg.h>
  +#include <pthread.h>
   
   /* debugging support, define this to enable code which helps detect re-use
    * of freed memory and other such nonsense.
  @@ -199,8 +199,7 @@
   
   
   static union block_hdr *block_freelist = NULL;
  -static mutex *alloc_mutex = NULL;
  -static mutex *spawn_mutex = NULL;
  +static pthread_mutex_t alloc_mutex = PTHREAD_MUTEX_INITIALIZER;
   #ifdef POOL_DEBUG
   static char *known_stack_point;
   static int stack_direction;
  @@ -320,7 +319,7 @@
       if (blok == NULL)
   	return;			/* Sanity check --- freeing empty pool? */
   
  -    (void) ap_acquire_mutex(alloc_mutex);
  +    (void) pthread_mutex_lock(&alloc_mutex);
       old_free_list = block_freelist;
       block_freelist = blok;
   
  @@ -339,7 +338,7 @@
       /* Finally, reset next pointer to get the old free blocks back */
   
       blok->h.next = old_free_list;
  -    (void) ap_release_mutex(alloc_mutex);
  +    (void) pthread_mutex_unlock(&alloc_mutex);
   #endif
   }
   
  @@ -388,9 +387,9 @@
   {
       union block_hdr *blok;
   
  -    (void) ap_acquire_mutex(alloc_mutex);
  +    (void) pthread_mutex_lock(&alloc_mutex);
       blok = new_block(min_size);
  -    (void) ap_release_mutex(alloc_mutex);
  +    (void) pthread_mutex_unlock(&alloc_mutex);
       return blok;
   }
   
  @@ -435,7 +434,7 @@
       union block_hdr *blok;
       root_pool *new_pool;
   
  -    (void) ap_acquire_mutex(alloc_mutex);
  +    (void) pthread_mutex_lock(&alloc_mutex);
   
       blok = new_block(ROOT_HDR_BYTES);
       new_pool = (root_pool *) blok->h.first_avail;
  @@ -449,7 +448,7 @@
       new_pool->p.first = new_pool->p.last = blok;
       new_pool->p.thread_root = new_pool;
   
  -    (void) ap_release_mutex(alloc_mutex);
  +    (void) pthread_mutex_unlock(&alloc_mutex);
       return (pool *)new_pool;
   }
   
  @@ -513,8 +512,6 @@
       known_stack_point = &s;
       stack_var_init(&s);
   #endif
  -    alloc_mutex = ap_create_mutex(NULL);
  -    spawn_mutex = ap_create_mutex(NULL);
       permanent_pool = ap_make_root_pool();
   
       return permanent_pool;
  @@ -554,7 +551,7 @@
   {
       ap_clear_pool(a);
   
  -    (void) ap_acquire_mutex(alloc_mutex);
  +    (void) pthread_mutex_lock(&alloc_mutex);
       if (a->parent) {
   	if (a->parent->sub_pools == a)
   	    a->parent->sub_pools = a->sub_next;
  @@ -563,7 +560,7 @@
   	if (a->sub_next)
   	    a->sub_next->sub_prev = a->sub_prev;
       }
  -    (void) ap_release_mutex(alloc_mutex);
  +    (void) pthread_mutex_unlock(&alloc_mutex);
   
       free_blocks(a->thread_root, a->first);
   }
  @@ -860,9 +857,9 @@
       cur_len = strp - blok->h.first_avail;
   
       /* must try another blok */
  -    (void) ap_acquire_mutex(alloc_mutex);
  +    (void) pthread_mutex_lock(&alloc_mutex);
       nblok = new_block(2 * cur_len);
  -    (void) ap_release_mutex(alloc_mutex);
  +    (void) pthread_mutex_unlock(&alloc_mutex);
       memcpy(nblok->h.first_avail, blok->h.first_avail, cur_len);
       ps->vbuff.curpos = nblok->h.first_avail + cur_len;
       /* save a byte for the NUL terminator */
  @@ -871,10 +868,10 @@
       /* did we allocate the current blok? if so free it up */
       if (ps->got_a_new_block) {
   	debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);
  -	(void) ap_acquire_mutex(alloc_mutex);
  +	(void) pthread_mutex_lock(&alloc_mutex);
   	blok->h.next = block_freelist;
   	block_freelist = blok;
  -	(void) ap_release_mutex(alloc_mutex);
  +	(void) pthread_mutex_unlock(&alloc_mutex);
       }
       ps->blok = nblok;
       ps->got_a_new_block = 1;
  
  
  
  1.8       +0 -1      apache-apr/pthreads/src/main/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/scoreboard.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- scoreboard.c	1999/04/09 04:10:37	1.7
  +++ scoreboard.c	1999/05/30 23:48:58	1.8
  @@ -4,7 +4,6 @@
   #include "http_core.h"
   #include "http_conf_globals.h"
   #include "scoreboard.h"
  -#include "multithread.h"
   #ifdef USE_SHMGET_SCOREBOARD
   #include <sys/types.h>
   #include <sys/ipc.h>
  
  
  
  1.2       +2 -4      apache-apr/pthreads/src/modules/proxy/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/Makefile.tmpl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- Makefile.tmpl	1999/01/21 23:08:35	1.1
  +++ Makefile.tmpl	1999/05/30 23:48:59	1.2
  @@ -69,8 +69,7 @@
    $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
    $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \
    $(INCDIR)/http_log.h $(INCDIR)/http_main.h \
  - $(INCDIR)/util_date.h $(INCDIR)/multithread.h \
  - $(INCDIR)/ap_md5.h
  + $(INCDIR)/util_date.h $(INCDIR)/ap_md5.h
   proxy_connect.o: proxy_connect.c mod_proxy.h $(INCDIR)/httpd.h \
    $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
    $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
  @@ -104,5 +103,4 @@
    $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
    $(INCDIR)/http_protocol.h $(INCDIR)/explain.h \
    $(INCDIR)/http_main.h $(INCDIR)/ap_md5.h \
  - $(INCDIR)/multithread.h $(INCDIR)/http_log.h \
  - $(INCDIR)/util_date.h
  + $(INCDIR)/http_log.h $(INCDIR)/util_date.h
  
  
  
  1.7       +7 -10     apache-apr/pthreads/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- proxy_cache.c	1999/03/22 20:43:39	1.6
  +++ proxy_cache.c	1999/05/30 23:48:59	1.7
  @@ -67,8 +67,8 @@
   #else
   #include <utime.h>
   #endif /* WIN32 */
  -#include "multithread.h"
   #include "ap_md5.h"
  +#include <pthread.h>
   
   DEF_Explain
   
  @@ -104,14 +104,11 @@
   static long61_t curbytes, cachesize;
   static time_t every, garbage_now, garbage_expire;
   static char *filename;
  -static mutex *garbage_mutex = NULL;
  +static pthread_mutex_t garbage_mutex = PTHREAD_MUTEX_INITIALIZER;
   
   
   int ap_proxy_garbage_init(server_rec *r, pool *p)
   {
  -    if (!garbage_mutex)
  -	garbage_mutex = ap_create_mutex(NULL);
  -
       return (0);
   }
   
  @@ -128,14 +125,14 @@
   {
       static int inside = 0;
   
  -    (void) ap_acquire_mutex(garbage_mutex);
  +    (void) pthread_mutex_lock(&garbage_mutex);
       if (inside == 1) {
  -	(void) ap_release_mutex(garbage_mutex);
  +	(void) pthread_mutex_unlock(&garbage_mutex);
   	return;
       }
       else
   	inside = 1;
  -    (void) ap_release_mutex(garbage_mutex);
  +    (void) pthread_mutex_unlock(&garbage_mutex);
   
   #if !defined(WIN32) && !defined(MPE) && !defined(OS2)
       detached_proxy_garbage_coll(r);
  @@ -143,9 +140,9 @@
       help_proxy_garbage_coll(r);
   #endif
   
  -    (void) ap_acquire_mutex(garbage_mutex);
  +    (void) pthread_mutex_lock(&garbage_mutex);
       inside = 0;
  -    (void) ap_release_mutex(garbage_mutex);
  +    (void) pthread_mutex_unlock(&garbage_mutex);
   }
   
   
  
  
  
  1.5       +4 -1      apache-apr/pthreads/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- proxy_util.c	1999/03/17 17:01:44	1.4
  +++ proxy_util.c	1999/05/30 23:48:59	1.5
  @@ -59,11 +59,12 @@
   #include "mod_proxy.h"
   #include "http_main.h"
   #include "ap_md5.h"
  -#include "multithread.h"
   #include "http_log.h"
   #include "util_uri.h"
   #include "util_date.h"	/* get ap_checkmask() decl. */
   
  +#include <pthread.h>
  +
   static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r);
  @@ -833,6 +834,8 @@
   {
       int i;
       struct hostent *hp;
  +/* XXX - Either get rid of TLS, or use pthread/APR functions */
  +#define APACHE_TLS
       static APACHE_TLS struct hostent hpbuf;
       static APACHE_TLS u_long ipaddr;
       static APACHE_TLS char *charpbuf[2];
  
  
  
  1.2       +1 -1      apache-apr/pthreads/src/modules/standard/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/Makefile.tmpl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- Makefile.tmpl	1999/01/21 23:08:38	1.1
  +++ Makefile.tmpl	1999/05/30 23:49:00	1.2
  @@ -240,7 +240,7 @@
    $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
    $(INCDIR)/alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \
    $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
  - $(INCDIR)/http_log.h $(INCDIR)/multithread.h
  + $(INCDIR)/http_log.h
   mod_userdir.o: mod_userdir.c $(INCDIR)/httpd.h \
    $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
    $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
  
  
  
  1.4       +0 -1      apache-apr/pthreads/src/modules/standard/mod_unique_id.c
  
  Index: mod_unique_id.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_unique_id.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- mod_unique_id.c	1999/03/18 16:35:48	1.3
  +++ mod_unique_id.c	1999/05/30 23:49:01	1.4
  @@ -65,7 +65,6 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_log.h"
  -#include "multithread.h"
   
   typedef struct {
       unsigned int stamp;
  
  
  
  1.2       +2 -2      apache-apr/pthreads/src/os/unix/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/os/unix/Makefile.tmpl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- Makefile.tmpl	1999/01/21 23:08:40	1.1
  +++ Makefile.tmpl	1999/05/30 23:49:01	1.2
  @@ -3,7 +3,7 @@
   INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
   LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
   
  -OBJS=	os.o os-inline.o multithread.o
  +OBJS=	os.o os-inline.o
   
   LIB=	libos.a
   
  @@ -45,5 +45,5 @@
   os.o: os.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
    $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
    $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h os.h
  -os.o: multithread.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
  +os.o: $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
    $(INCDIR)/ap_config_auto.h
  
  
  

Mime
View raw message