apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject cvs commit: apr/threadproc/unix signals.c
Date Wed, 21 Apr 2004 01:01:28 GMT
madhum      2004/04/20 18:01:28

  Modified:    .        CHANGES
               threadproc/unix signals.c
  Log:
  Added two new functions apr_signal_block and apr_signal_unblock to
  block/unblock only certain signals.
  
  Revision  Changes    Path
  1.462     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.461
  retrieving revision 1.462
  diff -u -r1.461 -r1.462
  --- CHANGES	18 Apr 2004 12:12:49 -0000	1.461
  +++ CHANGES	21 Apr 2004 01:01:28 -0000	1.462
  @@ -7,6 +7,9 @@
   
   Changes with APR 1.0
   
  +  *) Add new functions apr_signal_block, apr_signal_unblock to block/unblock
  +     the delivery of a particular signal. [Madhusudan Mathihalli]
  +
     *) Add support for developers to use their own hashing function with
        apr_hash_make_custom.  [Ami Ganguli <hse_ami@yahoo.co.uk>]
   
  
  
  
  1.58      +46 -0     apr/threadproc/unix/signals.c
  
  Index: signals.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/signals.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- signals.c	13 Feb 2004 09:38:37 -0000	1.57
  +++ signals.c	21 Apr 2004 01:01:28 -0000	1.58
  @@ -423,4 +423,50 @@
       return rv;
   }
   
  +APR_DECLARE(apr_status_t) apr_signal_block(int signum)
  +{
  +    sigset_t sig_mask;
  +    int rv;
  +
  +    sigemptyset(&sig_mask);
  +
  +    sigaddset(&sig_mask, signum);
  +
  +#if defined(SIGPROCMASK_SETS_THREAD_MASK)
  +    if ((rv = sigprocmask(SIG_BLOCK, &sig_mask, NULL)) != 0) {
  +        rv = errno;
  +    }
  +#else
  +    if ((rv = pthread_sigmask(SIG_BLOCK, &sig_mask, NULL)) != 0) {
  +#ifdef PTHREAD_SETS_ERRNO
  +        rv = errno;
  +#endif
  +    }
  +#endif
  +    return rv;
  +}
  +
  +APR_DECLARE(apr_status_t) apr_signal_unblock(int signum)
  +{
  +    sigset_t sig_mask;
  +    int rv;
  +
  +    sigemptyset(&sig_mask);
  +
  +    sigaddset(&sig_mask, signum);
  +
  +#if defined(SIGPROCMASK_SETS_THREAD_MASK)
  +    if ((rv = sigprocmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) {
  +        rv = errno;
  +    }
  +#else
  +    if ((rv = pthread_sigmask(SIG_UNBLOCK, &sig_mask, NULL)) != 0) {
  +#ifdef PTHREAD_SETS_ERRNO
  +        rv = errno;
  +#endif
  +    }
  +#endif
  +    return rv;
  +}
  +
   #endif
  
  
  

Mime
View raw message