manoj       99/04/15 21:43:02

  Modified:    pthreads/src/main acceptlock.c
  Log:
  For pthread serialization: ifdef out an added signal mask call that
  isn't needed in the current server architecture, and fix up that same
  code so it can be turned on again if need be.
  
  Revision  Changes    Path
  1.6       +19 -7     apache-apr/pthreads/src/main/acceptlock.c
  
  Index: acceptlock.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -u -r1.5 -r1.6
  --- acceptlock.c      1999/04/14 22:44:56     1.5
  +++ acceptlock.c      1999/04/16 04:43:01     1.6
  @@ -175,8 +175,13 @@
   
   static pthread_mutex_t *accept_mutex = (void *)(caddr_t) -1;
   static int *have_accept_mutex;
  +/* The sections surrounded with this ifdef are not needed because of the
  + * sigwait thread. They may be turned back on, though, depending on how the
  + * port to nonthreaded mode goes */
  +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS
   static sigset_t accept_block_mask;
  -static sigset_t accept_previous_mask;
  +static sigset_t *accept_previous_masks = NULL;
  +#endif
   
   void accept_mutex_child_cleanup(void *foo)
   {
  @@ -193,6 +198,9 @@
   void accept_mutex_child_init(pool *p)
   {
       ap_register_cleanup(p, NULL, accept_mutex_child_cleanup, 
ap_null_cleanup);
  +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS
  +    accept_previous_masks = ap_palloc(p, lock_count * sizeof(sigset_t));
  +#endif
   }
   
   void accept_mutex_cleanup(void *foo)
  @@ -249,10 +257,12 @@
           perror("pthread_mutexattr_destroy");
           exit(APEXIT_INIT);
       }
  +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS
       sigfillset(&accept_block_mask);
       sigdelset(&accept_block_mask, SIGHUP);
       sigdelset(&accept_block_mask, SIGTERM);
       sigdelset(&accept_block_mask, SIGWINCH);
  +#endif
       ap_register_cleanup(p, NULL, accept_mutex_cleanup, ap_null_cleanup);
   }
   
  @@ -260,10 +270,10 @@
   {
       int err;
   
  -    /* Already blocking out all signals in worker threads. */
  -#if 0
  -    if (sigprocmask(SIG_BLOCK, &accept_block_mask, &accept_previous_mask)) {
  -     perror("sigprocmask(SIG_BLOCK)");
  +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS
  +    if (pthread_sigmask(SIG_BLOCK, &accept_block_mask,
  +                        &accept_previous_mask[locknum])) {
  +     perror("pthread_sigmask(SIG_BLOCK)");
        clean_child_exit(APEXIT_CHILDFATAL);
       }
   #endif
  @@ -298,10 +308,12 @@
        * hits.
        */
       have_accept_mutex[locknum] = 0;
  -    if (sigprocmask(SIG_SETMASK, &accept_previous_mask, NULL)) {
  -     perror("sigprocmask(SIG_SETMASK)");
  +#ifdef NEED_TO_BLOCK_SIGNALS_AROUND_PTHREAD_CALLS
  +    if (pthread_sigmask(SIG_SETMASK, &accept_previous_mask[locknum], NULL)) {
  +     perror("pthread_sigmask(SIG_SETMASK)");
        clean_child_exit(1);
       }
  +#endif
   }
   
   #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT)
  
  
  

Reply via email to