Date: Fri, 31 Dec 2004 15:06:21 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67989 for review Message-ID: <200412311506.iBVF6L3A009651@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67989 Change 67989 by davidxu@davidxu_tiger on 2004/12/31 15:05:58 now suspending a thread is supported, required by java. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_suspend_np.c#3 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_suspend_np.c#3 (text+ko) ==== @@ -35,7 +35,7 @@ #include <pthread.h> #include "thr_private.h" -static void suspend_common(struct pthread *thread); +static inline void suspend_common(struct pthread *thread); __weak_reference(_pthread_suspend_np, pthread_suspend_np); __weak_reference(_pthread_suspend_all_np, pthread_suspend_all_np); @@ -73,7 +73,7 @@ struct pthread *thread; /* Take the thread list lock: */ - THR_LOCK_ACQUIRE(curthread, &_thread_list_lock); + THREAD_LIST_LOCK(curthread); TAILQ_FOREACH(thread, &_thread_list, tle) { if (thread != curthread) { @@ -84,16 +84,14 @@ } /* Release the thread list lock: */ - THR_LOCK_RELEASE(curthread, &_thread_list_lock); + THREAD_LIST_UNLOCK(curthread); } -void +static inline void suspend_common(struct pthread *thread) { - if ((thread->state != PS_DEAD) && - (thread->state != PS_DEADLOCK) && - ((thread->flags & THR_FLAGS_EXITING) == 0)) { - thread->flags |= THR_FLAGS_SUSPENDED; - /* XXX how ? */ + if (thread->state != PS_DEAD) { + thread->flags |= THR_FLAGS_NEED_SUSPEND; + thr_kill(thread->tid, SIGCANCEL); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412311506.iBVF6L3A009651>