On Fri, Sep 19, 2003 at 12:39:04AM +0100, Philip Blundell wrote:
> On Thu, 2003-09-18 at 23:36, Philip Blundell wrote:
> > I'll try adding these functions to __libc_pthread_functions and see if
> > that helps.
> 
> Well, it seems to do the trick with that testcase.
> 
> p.
> 

<bits/libc-lock.h> is an installed header, and the public versions of
pthread_cleanup_push call these.  I don't think we can do that.

> ? linuxthreads/sysdeps/pthread/bits/libc-lock.diff
> Index: linuxthreads/forward.c
> ===================================================================
> RCS file: /cvs/glibc/libc/linuxthreads/forward.c,v
> retrieving revision 1.5
> diff -u -r1.5 forward.c
> --- linuxthreads/forward.c    2 Sep 2003 00:37:04 -0000       1.5
> +++ linuxthreads/forward.c    18 Sep 2003 23:36:32 -0000
> @@ -173,3 +173,7 @@
>        0)
>  
>  FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
> +
> +FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, 
> void (*routine)(void *), void * arg), (buffer, routine, arg), return)
> +
> +FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int 
> execute), (buffer, execute), return)
> Index: linuxthreads/pthread.c
> ===================================================================
> RCS file: /cvs/glibc/libc/linuxthreads/pthread.c,v
> retrieving revision 1.130
> diff -u -r1.130 pthread.c
> --- linuxthreads/pthread.c    17 Sep 2003 09:39:16 -0000      1.130
> +++ linuxthreads/pthread.c    18 Sep 2003 23:36:32 -0000
> @@ -279,7 +279,9 @@
>      .ptr_pthread_cleanup_upto = __pthread_cleanup_upto,
>      .ptr_pthread_sigaction = __pthread_sigaction,
>      .ptr_pthread_sigwait = __pthread_sigwait,
> -    .ptr_pthread_raise = __pthread_raise
> +    .ptr_pthread_raise = __pthread_raise,
> +    .ptr__pthread_cleanup_push = _pthread_cleanup_push,
> +    .ptr__pthread_cleanup_pop = _pthread_cleanup_pop
>    };
>  #ifdef SHARED
>  # define ptr_pthread_functions &__pthread_functions
> Index: linuxthreads/sysdeps/pthread/pthread-functions.h
> ===================================================================
> RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/pthread/pthread-functions.h,v
> retrieving revision 1.3
> diff -u -r1.3 pthread-functions.h
> --- linuxthreads/sysdeps/pthread/pthread-functions.h  10 Sep 2003 22:27:19 -0000     
>  1.3
> +++ linuxthreads/sysdeps/pthread/pthread-functions.h  18 Sep 2003 23:36:33 -0000
> @@ -83,6 +83,11 @@
>    int (*ptr_pthread_raise) (int sig);
>    int (*ptr___pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *,
>                                      const struct timespec *);
> +  void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer,
> +                                  void (*routine)(void *), void * arg);
> +
> +  void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer,
> +                                 int execute);
>  };
>  
>  /* Variable in libc.so.  */
> Index: linuxthreads/sysdeps/pthread/bits/libc-lock.h
> ===================================================================
> RCS file: /cvs/glibc/libc/linuxthreads/sysdeps/pthread/bits/libc-lock.h,v
> retrieving revision 1.31
> diff -u -r1.31 libc-lock.h
> --- linuxthreads/sysdeps/pthread/bits/libc-lock.h     8 Aug 2003 07:40:17 -0000      
>  1.31
> +++ linuxthreads/sysdeps/pthread/bits/libc-lock.h     18 Sep 2003 23:36:33 -0000
> @@ -265,18 +265,12 @@
>      }
>  
>  #define __libc_cleanup_push(fct, arg) \
> -  { struct _pthread_cleanup_buffer _buffer;                                \
> -    int _avail = _pthread_cleanup_push != NULL;                                    \
> -    if (_avail) {                                                          \
> -      _pthread_cleanup_push (&_buffer, (fct), (arg));                              \
> -    }
> +    { struct _pthread_cleanup_buffer _buffer;                                      \
> +    __libc_maybe_call (_pthread_cleanup_push, (&_buffer, (fct), (arg)), 0)
>  
>  #define __libc_cleanup_pop(execute) \
> -    if (_avail) {                                                          \
> -      _pthread_cleanup_pop (&_buffer, execute);                                    \
> -    }                                                                              \
> -  }
> -
> +    __libc_maybe_call (_pthread_cleanup_pop, (&_buffer, execute), 0);              \
> +    }
>  
>  /* Create thread-specific key.  */
>  #define __libc_key_create(KEY, DESTRUCTOR) \


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to