Deleted Added
sdiff udiff text old ( 76909 ) new ( 81750 )
full compact
1/*
2 * David Leonard <d@openbsd.org>, 1999. Public domain.
3 * $FreeBSD: head/lib/libkse/thread/thr_cancel.c 76909 2001-05-20 23:08:33Z jasone $
4 */
5#include <sys/errno.h>
6#include <pthread.h>
7#include "pthread_private.h"
8
9static void finish_cancellation(void *arg);
10
11__weak_reference(_pthread_cancel, pthread_cancel);

--- 47 unchanged lines hidden (view full) ---

59 case PS_SIGWAIT:
60 /* Interrupt and resume: */
61 pthread->interrupted = 1;
62 pthread->cancelflags |= PTHREAD_CANCELLING;
63 PTHREAD_NEW_STATE(pthread,PS_RUNNING);
64 break;
65
66 case PS_JOIN:
67 case PS_SUSPENDED:
68 if (pthread->suspended == SUSP_NO ||
69 pthread->suspended == SUSP_YES ||
70 pthread->suspended == SUSP_NOWAIT) {
71 /*
72 * This thread isn't in any scheduling
73 * queues; just change it's state:
74 */
75 pthread->cancelflags |=
76 PTHREAD_CANCELLING;
77 PTHREAD_SET_STATE(pthread, PS_RUNNING);

--- 106 unchanged lines hidden (view full) ---

184 ((curthread->cancelflags & PTHREAD_CANCELLING) != 0)) {
185 /*
186 * It is possible for this thread to be swapped out
187 * while performing cancellation; do not allow it
188 * to be cancelled again.
189 */
190 curthread->cancelflags &= ~PTHREAD_CANCELLING;
191 _thread_exit_cleanup();
192 pthread_detach((pthread_t)curthread);
193 pthread_exit(PTHREAD_CANCELED);
194 PANIC("cancel");
195 }
196}
197
198void
199_thread_enter_cancellation_point(void)
200{

--- 20 unchanged lines hidden (view full) ---

221 struct pthread *curthread = _get_curthread();
222
223 curthread->continuation = NULL;
224 curthread->interrupted = 0;
225
226 if ((curthread->cancelflags & PTHREAD_CANCEL_NEEDED) != 0) {
227 curthread->cancelflags &= ~PTHREAD_CANCEL_NEEDED;
228 _thread_exit_cleanup();
229 pthread_detach((pthread_t)curthread);
230 pthread_exit(PTHREAD_CANCELED);
231 }
232}