1 |
/* Deallocate the kernel thread resources. Mach version. |
/* Deallocate the kernel thread resources. Mach version. |
2 |
Copyright (C) 2000,02 Free Software Foundation, Inc. |
Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. |
3 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
4 |
|
|
5 |
The GNU C Library is free software; you can redistribute it and/or |
The GNU C Library is free software; you can redistribute it and/or |
23 |
|
|
24 |
#include <pt-internal.h> |
#include <pt-internal.h> |
25 |
|
|
26 |
|
/* Stop the kernel thread associated with THREAD. If NEED_DEALLOC is |
27 |
|
true, the function must call __pthread_dealloc on THREAD. |
28 |
|
|
29 |
/* Deallocate the kernel thread resources associated with THREAD. */ |
NB: The thread executing this function may be the thread which is |
30 |
|
being halted, thus the last action should be halting the thread |
31 |
|
itself. */ |
32 |
void |
void |
33 |
__pthread_thread_halt (struct __pthread *thread) |
__pthread_thread_halt (struct __pthread *thread, int need_dealloc) |
34 |
{ |
{ |
35 |
error_t err; |
error_t err; |
36 |
|
thread_t tid = thread->kernel_thread; |
37 |
|
|
38 |
err = __mach_port_deallocate (__mach_task_self (), |
if (need_dealloc) |
39 |
thread->wakeupmsg.msgh_remote_port); |
__pthread_dealloc (thread); |
|
assert_perror (err); |
|
40 |
|
|
41 |
err = __thread_terminate (thread->kernel_thread); |
err = __thread_terminate (tid); |
42 |
assert_perror (err); |
assert_perror (err); |
43 |
} |
} |