From owner-p4-projects@FreeBSD.ORG Fri Dec 31 15:06:23 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D3D3116A514; Fri, 31 Dec 2004 15:06:22 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 154CF16A4DF for ; Fri, 31 Dec 2004 15:06:22 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E817A43D46 for ; Fri, 31 Dec 2004 15:06:21 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iBVF6LOE009654 for ; Fri, 31 Dec 2004 15:06:21 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iBVF6L3A009651 for perforce@freebsd.org; Fri, 31 Dec 2004 15:06:21 GMT (envelope-from davidxu@freebsd.org) Date: Fri, 31 Dec 2004 15:06:21 GMT Message-Id: <200412311506.iBVF6L3A009651@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 67989 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Dec 2004 15:06:23 -0000 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 #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); } }