cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c

1999-05-09 Thread manoj
manoj   99/05/09 01:39:32

  Modified:pthreads/src/include acceptlock.h
   pthreads/src/main acceptlock.c http_accept.c
  Log:
  Partial solution for the graceful restart during accept locking problem.
  Make sure that each thread checks the shutdown flag before attempting to
  get the cross-process accept lock, so that if one thread notices that
  it's time to die, the rest will soon after.
  
  Revision  ChangesPath
  1.5   +7 -2  apache-apr/pthreads/src/include/acceptlock.h
  
  Index: acceptlock.h
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- acceptlock.h  1999/04/17 03:35:53 1.4
  +++ acceptlock.h  1999/05/09 08:39:29 1.5
  @@ -62,6 +62,11 @@
   extern C {
   #endif
 
  +/* Prototypes for the intraprocess accept mutex functions */
  +void intra_mutex_init(pool *p, int);
  +void intra_mutex_on(int);
  +void intra_mutex_off(int);
  +
   /* Prototyps for the accept mutex functions. */
   #if defined (USE_USLOCK_SERIALIZED_ACCEPT)
   #define accept_mutex_child_init(x)
  @@ -79,13 +84,13 @@
   
   #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT)
   void accept_mutex_cleanup(void *);
  -void accept_mutex_child_init(pool *);
  +#define accept_mutex_child_init(x)
   void accept_mutex_init(pool *, int);
   void accept_mutex_on(int);
   void accept_mutex_off(int);
   
   #elif defined(USE_FCNTL_SERIALIZED_ACCEPT)
  -void accept_mutex_child_init(pool *);
  +#define accept_mutex_child_init(x)
   void accept_mutex_init(pool *, int);
   void accept_mutex_on(int);
   void accept_mutex_off(int);
  
  
  
  1.9   +10 -29apache-apr/pthreads/src/main/acceptlock.c
  
  Index: acceptlock.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- acceptlock.c  1999/04/22 19:09:01 1.8
  +++ acceptlock.c  1999/05/09 08:39:30 1.9
  @@ -83,25 +83,28 @@
   /* Number of cross-process locks we're managing */
   static int lock_count;
   
  +/* Number of intra-process locks we're managing */
  +static int intra_lock_count;
  +
   /* Intraprocess locking used by other serialization techniques */
  -#ifdef NEED_INTRAPROCESS_SERIALIZED_ACCEPT
   static pthread_mutex_t *intra_mutex = NULL;
   
   static void intra_mutex_cleanup(void *foo)
   {
   int i;
   
  -for (i = 0; i  lock_count; i++) {
  +for (i = 0; i  intra_lock_count; i++) {
   (void) pthread_mutex_destroy(intra_mutex[i]);
   }
   }
   
  -static void intra_mutex_init(pool *p)
  +void intra_mutex_init(pool *p, int number_of_locks)
   {
   int i;
   
  -intra_mutex = (pthread_mutex_t *)ap_palloc(p, lock_count * 
sizeof(pthread_mutex_t ));
  -for (i = 0; i  lock_count; i++) {
  +intra_lock_count = number_of_locks;
  +intra_mutex = (pthread_mutex_t *)ap_palloc(p, intra_lock_count * 
sizeof(pthread_mutex_t ));
  +for (i = 0; i  intra_lock_count; i++) {
   if (pthread_mutex_init(intra_mutex[i], NULL) != 0) {
   perror(intra_mutex_init);
clean_child_exit(APEXIT_CHILDFATAL);
  @@ -110,7 +113,7 @@
   ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup);
   }
   
  -static void intra_mutex_on(int locknum)
  +void intra_mutex_on(int locknum)
   {
   if ((errno = pthread_mutex_lock(intra_mutex[locknum])) != 0) {
   ap_log_error(APLOG_MARK, APLOG_EMERG, 
  @@ -119,7 +122,7 @@
   }
   }
   
  -static void intra_mutex_off(int locknum)
  +void intra_mutex_off(int locknum)
   {
   if (pthread_mutex_unlock(intra_mutex[locknum]) != 0) {
   ap_log_error(APLOG_MARK, APLOG_EMERG, 
  @@ -127,11 +130,6 @@
 Error releasing intraprocess lock. Exiting!);
   }
   }
  -#else /* NEED_INTRAPROCESS_SERIALIZED_ACCEPT */
  -#define intra_mutex_init(x)
  -#define intra_mutex_on(x)
  -#define intra_mutex_off(x)
  -#endif /* NEED_INTRAPROCESS_SERIALIZED_ACCEPT */
   
   #if defined(USE_FCNTL_SERIALIZED_ACCEPT) || 
defined(USE_FLOCK_SERIALIZED_ACCEPT)
   static void init_lock_fname(pool *p)
  @@ -454,14 +452,8 @@
   }
   }
   
  -void accept_mutex_child_init(pool *p)
  -{
  -intra_mutex_init(p);
  -}
  -
   void accept_mutex_on(int locknum)
   {
  -intra_mutex_on(locknum);
   if (semop(sem_id[locknum], op_on, 1)  0) {
perror(accept_mutex_on);
clean_child_exit(APEXIT_CHILDFATAL);
  @@ -474,7 +466,6 @@
perror(accept_mutex_off);
clean_child_exit(APEXIT_CHILDFATAL);
   }
  -intra_mutex_off(locknum);
   }
   
   #elif defined(USE_FCNTL_SERIALIZED_ACCEPT)
  @@ -519,16 +510,10 @@
   }
   }
   
  -void accept_mutex_child_init(pool *p)
  -{
  -intra_mutex_init(p);
  -}
  -
   void accept_mutex_on(int 

cvs commit: apache-apr/pthreads/src/include http_accept.h

1999-05-09 Thread manoj
manoj   99/05/09 01:46:27

  Modified:pthreads/src/include http_accept.h
  Log:
  Make the poll-accept model the default.
  
  Revision  ChangesPath
  1.8   +2 -2  apache-apr/pthreads/src/include/http_accept.h
  
  Index: http_accept.h
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- http_accept.h 1999/04/29 20:09:42 1.7
  +++ http_accept.h 1999/05/09 08:46:27 1.8
  @@ -75,8 +75,8 @@
   } proc_info;
   
   /* Select the accept technique. Move this to ap_config eventually... */
  -#define USE_ACCEPT_QUEUE
  -/*#define USE_MULTI_ACCEPT*/
  +/*#define USE_ACCEPT_QUEUE*/
  +#define USE_MULTI_ACCEPT
   
   void accept_parent_init(pool*, int);
   void accept_child_init(pool*, int);
  
  
  


Re: cvs commit: apache-apr/pthreads/src/main acceptlock.c http_accept.c

1999-05-09 Thread Dirk-Willem van Gulik


On 9 May 1999 [EMAIL PROTECTED] wrote:

   Partial solution for the graceful restart during accept locking problem.
   Make sure that each thread checks the shutdown flag before attempting to
   get the cross-process accept lock, so that if one thread notices that
   it's time to die, the rest will soon after.
   
   Revision  ChangesPath
   1.5   +7 -2  apache-apr/pthreads/src/include/acceptlock.h

Good stuff ! Seems to make a/the difference.

Dw