+2000-06-10 Ulrich Drepper <drepper@redhat.com>
+
+ * pthread.c (__pthread_create_2_1): Optimize a bit.
+
+ * internals.h (invalid_handle): Also test for p_terminated != 0.
+ (nonexisting_handle): New function. Same as old invalid_handle.
+ * join.c (pthread_join): Use nonexisting_handle instead of
+ invalid_handle to test for acceptable thread handle.
+ Reported by Permaine Cheung <pcheung@cygnus.com>.
+
2000-06-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/pthread/timer_routines.c (__timer_thread_queue_timer):
static inline int invalid_handle(pthread_handle h, pthread_t id)
{
+ return h->h_descr == NULL || h->h_descr->p_tid != id || h->h_descr->p_terminated;
+}
+
+static inline int nonexisting_handle(pthread_handle h, pthread_t id)
+{
return h->h_descr == NULL || h->h_descr->p_tid != id;
}
extr.pu_extricate_func = join_extricate_func;
__pthread_lock(&handle->h_lock, self);
- if (invalid_handle(handle, thread_id)) {
+ if (nonexisting_handle(handle, thread_id)) {
__pthread_unlock(&handle->h_lock);
return ESRCH;
}
{
pthread_descr self = thread_self();
struct pthread_request request;
+ int retval;
if (__pthread_manager_request < 0) {
if (__pthread_initialize_manager() < 0) return EAGAIN;
}
&request.req_args.create.mask);
__libc_write(__pthread_manager_request, (char *) &request, sizeof(request));
suspend(self);
- if (THREAD_GETMEM(self, p_retcode) == 0)
+ retval = THREAD_GETMEM(self, p_retcode;
+ if (retval == 0)
*thread = (pthread_t) THREAD_GETMEM(self, p_retval);
- return THREAD_GETMEM(self, p_retcode);
+ return retval;
}
versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);