PERFORCE change 67989 for review

David Xu davidxu at FreeBSD.org
Fri Dec 31 07:06:23 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=67989

Change 67989 by davidxu at 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);
 	}
 }


More information about the p4-projects mailing list