You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/06/10 12:57:25 UTC

cvs commit: apr/threadproc/win32 thread.c

jorton      2004/06/10 03:57:25

  Modified:    .        configure.in
               include  apr_thread_proc.h
               threadproc/beos thread.c
               threadproc/netware thread.c
               threadproc/os2 thread.c
               threadproc/unix thread.c
               threadproc/win32 thread.c
  Log:
  Add apr_threadattr_guardsize_set function, which allows changing
  the thread guard area size attribute for newly created threads.
  
  * configure.in: Check for pthread_attr_setguardsize.
  
  * include/apr_thread_proc.h (apr_threadattr_guardsize_set): Add
  prototype.
  
  * threadproc/unix/thread.c (apr_threadattr_guardsize_set): Add
  function.
  
  * threadproc/os2/thread.c, threadproc/win32/thread.c,
  threadproc/beos/thread.c, threadproc/netware/thread.c
  (apr_threadattr_guardsize_set): Add ENOTIMPL stubs.
  
  Revision  Changes    Path
  1.586     +3 -7      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.585
  retrieving revision 1.586
  diff -d -w -u -r1.585 -r1.586
  --- configure.in	5 Jun 2004 11:52:43 -0000	1.585
  +++ configure.in	10 Jun 2004 10:57:24 -0000	1.586
  @@ -578,7 +578,8 @@
           APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
           APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
           APR_CHECK_PTHREAD_RECURSIVE_MUTEX
  -        AC_CHECK_FUNCS(pthread_key_delete pthread_rwlock_init)
  +        AC_CHECK_FUNCS([pthread_key_delete pthread_rwlock_init \
  +                        pthread_attr_setguardsize])
   
           if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
               dnl ----------------------------- Checking for pthread_rwlock_t
  @@ -1598,7 +1599,7 @@
   # See which lock mechanism we'll select by default on this system.
   # The last APR_DECIDE to execute sets the default.
   # At this stage, we match the ordering in Apache 1.3
  -# which is (highest to lowest): pthread -> posixsem -> sysvsem -> fcntl -> flock
  +# which is (highest to lowest): posixsem -> sysvsem -> fcntl -> flock
   #
   APR_BEGIN_DECISION([apr_lock implementation method])
   APR_IFALLYES(func:flock define:LOCK_EX,
  @@ -1610,11 +1611,6 @@
   APR_IFALLYES(header:semaphore.h func:sem_open func_sem_close dnl
                func_sem_unlink func:sem_post func_sem_wait,
                APR_DECIDE(USE_POSIXSEM_SERIALIZE, [POSIX sem_open()]))
  -# note: the current APR use of shared mutex requires /dev/zero
  -APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
  -            func:pthread_mutexattr_setpshared dnl
  -            file:/dev/zero,
  -            APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread mutex]))
   if test "x$apr_lock_method" != "x"; then
       APR_DECISION_FORCE($apr_lock_method)
   fi
  
  
  
  1.105     +13 -0     apr/include/apr_thread_proc.h
  
  Index: apr_thread_proc.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_thread_proc.h,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -d -w -u -r1.104 -r1.105
  --- apr_thread_proc.h	4 Jun 2004 13:28:21 -0000	1.104
  +++ apr_thread_proc.h	10 Jun 2004 10:57:24 -0000	1.105
  @@ -224,6 +224,19 @@
                                                          apr_size_t stacksize);
   
   /**
  + * Set the stack guard area size of newly created threads.
  + * @param attr The threadattr to affect 
  + * @param guardsize The stack guard area size in bytes
  + * @note Thread library implementations commonly use a "guard area"
  + * after each thread's stack which is not readable or writable such that
  + * stack overflows cause a segfault; this consumes e.g. 4K of memory
  + * and increases memory management overhead.  Setting the guard area
  + * size to zero hence trades off reliable behaviour on stack overflow
  + * for performance. */
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t guardsize);
  +
  +/**
    * Create a new thread of execution
    * @param new_thread The newly created thread handle.
    * @param attr The threadattr to use to determine how to create the thread
  
  
  
  1.39      +6 -0      apr/threadproc/beos/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/beos/thread.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -d -w -u -r1.38 -r1.39
  --- thread.c	1 Mar 2004 21:05:44 -0000	1.38
  +++ thread.c	10 Jun 2004 10:57:25 -0000	1.39
  @@ -55,6 +55,12 @@
       return APR_ENOTIMPL;
   }
   
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t size)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
   static void *dummy_worker(void *opaque)
   {
       apr_thread_t *thd = (apr_thread_t*)opaque;
  
  
  
  1.17      +6 -0      apr/threadproc/netware/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/netware/thread.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -d -w -u -r1.16 -r1.17
  --- thread.c	1 Mar 2004 21:05:44 -0000	1.16
  +++ thread.c	10 Jun 2004 10:57:25 -0000	1.17
  @@ -57,6 +57,12 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t size)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
   static void *dummy_worker(void *opaque)
   {
       apr_thread_t *thd = (apr_thread_t *)opaque;
  
  
  
  1.40      +6 -0      apr/threadproc/os2/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/os2/thread.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -d -w -u -r1.39 -r1.40
  --- thread.c	1 Mar 2004 21:05:44 -0000	1.39
  +++ thread.c	10 Jun 2004 10:57:25 -0000	1.40
  @@ -59,6 +59,12 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t size)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
   static void apr_thread_begin(void *arg)
   {
     apr_thread_t *thread = (apr_thread_t *)arg;
  
  
  
  1.58      +19 -0     apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/thread.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -d -w -u -r1.57 -r1.58
  --- thread.c	1 Mar 2004 21:05:44 -0000	1.57
  +++ thread.c	10 Jun 2004 10:57:25 -0000	1.58
  @@ -94,6 +94,25 @@
       return stat;
   }
   
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t size)
  +{
  +#ifdef HAVE_PTHREAD_ATTR_SETGUARDSIZE
  +    apr_status_t rv;
  +
  +    rv = pthread_attr_setguardsize(&attr->attr, size);
  +    if (rv == 0) {
  +        return APR_SUCCESS;
  +    }
  +#ifdef PTHREAD_SETS_ERRNO
  +    rv = errno;
  +#endif
  +    return rv;
  +#else
  +    return APR_ENOTIMPL;
  +#endif
  +}
  +
   static void *dummy_worker(void *opaque)
   {
       apr_thread_t *thread = (apr_thread_t*)opaque;
  
  
  
  1.57      +6 -0      apr/threadproc/win32/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/thread.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -d -w -u -r1.56 -r1.57
  --- thread.c	1 Mar 2004 21:05:44 -0000	1.56
  +++ thread.c	10 Jun 2004 10:57:25 -0000	1.57
  @@ -65,6 +65,12 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
  +                                                       apr_size_t size)
  +{
  +    return APR_ENOTIMPL;
  +}
  +
   static void *dummy_worker(void *opaque)
   {
       apr_thread_t *thd = (apr_thread_t *)opaque;