summaryrefslogtreecommitdiff
path: root/sysdeps/mach/pt-thread-alloc.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2005-05-04 16:04:06 +0000
committerNeal H. Walfield <neal@gnu.org>2005-05-04 16:04:06 +0000
commit317c73af1d3142947ba5f5d2f5251c4a34abda52 (patch)
tree30eec32b35610075d5313565a332cfc9a6d8ddee /sysdeps/mach/pt-thread-alloc.c
parent6c7755ebb4718153b144b59f9becbf1b5e785f02 (diff)
libpthread/
2005-05-04 Neal H. Walfield <neal@gnu.org> * Makefile (SRCS): Add pt-thread_dealloc.c. * sysdeps/mach/pt-thread-dealloc.c: New file. * pthread/pt-internal.h (__pthread_thread_dealloc): New declaration. (__pthread_thread_halt): Add parameter NEED_DEALLOC. Update callers. * sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt): Respect new NEED_DEALLOC parameter. Move code which deallocates kernel resources from here ... * sysdeps/mach/pt-thread-dealloc.c (__pthread_thread_dealloc): ...to here. * pthread/pt-create.c (__pthread_create_internal): Call __pthread_thread_dealloc on failure. * pthread/pt-exit.c (pthread_exit): Call __pthread_thread_dealloc. * sysdeps/mach/pt-thread-alloc.c (create_wakeupmsg): Call __mach_port_destroy to deallocate the receive right. __mach_port_deallocate won't do it. * pthread/pt-detach.c (pthread_detach): Don't call __pthread_thread_halt a second time. * sysdeps/mach/hurd/pt-sysdep.c (_cthread_init_routine): Fix declaration. (init_routine): Update declaration and remove gratuitous cast.
Diffstat (limited to 'sysdeps/mach/pt-thread-alloc.c')
-rw-r--r--sysdeps/mach/pt-thread-alloc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sysdeps/mach/pt-thread-alloc.c b/sysdeps/mach/pt-thread-alloc.c
index a191c712..1acba98a 100644
--- a/sysdeps/mach/pt-thread-alloc.c
+++ b/sysdeps/mach/pt-thread-alloc.c
@@ -1,5 +1,5 @@
/* Start thread. Mach version.
- Copyright (C) 2000,02 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -50,8 +50,8 @@ create_wakeupmsg (struct __pthread *thread)
MACH_MSG_TYPE_MAKE_SEND);
if (err)
{
- __mach_port_deallocate (__mach_task_self (),
- thread->wakeupmsg.msgh_remote_port);
+ __mach_port_destroy (__mach_task_self (),
+ thread->wakeupmsg.msgh_remote_port);
return EAGAIN;
}
@@ -86,7 +86,8 @@ __pthread_thread_alloc (struct __pthread *thread)
{
assert (__pthread_total == 0);
thread->kernel_thread = __mach_thread_self ();
- /* We implicitly hold a reference. */
+ /* We implicitly hold a reference drop the one that we just
+ acquired. */
__mach_port_deallocate (__mach_task_self (), thread->kernel_thread);
}
else