Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 May 2003 22:30:22 +0900
From:      Kazuaki Oda <kaakun@highway.ne.jp>
To:        threads@freebsd.org
Subject:   Patch for running Java2D demo (jdk-1.4.1p3_3)
Message-ID:  <20030504223022.5335f30f.kaakun@highway.ne.jp>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi,

After applying the attached patch, I've been able to run Java2D demo
under jdk-1.4.1p3_3 with libpthread (libkse).

This patch is for problem with suspending and resuming thread.

Please review.

--
Kazuaki Oda (kaakun@highway.ne.jp)

[-- Attachment #2 --]
diff -ru libpthread.orig/thread/thr_create.c libpthread/thread/thr_create.c
--- libpthread.orig/thread/thr_create.c	Thu May  1 02:08:12 2003
+++ libpthread/thread/thr_create.c	Sun May  4 00:44:28 2003
@@ -259,9 +259,10 @@
 			new_thread->flags = 0;
 			new_thread->continuation = NULL;
 
-			if (new_thread->attr.suspend == THR_CREATE_SUSPENDED)
+			if (new_thread->attr.suspend == THR_CREATE_SUSPENDED) {
 				new_thread->state = PS_SUSPENDED;
-			else
+				new_thread->flags = THR_FLAGS_SUSPENDED;
+			} else
 				new_thread->state = PS_RUNNING;
 
 			/*
diff -ru libpthread.orig/thread/thr_resume_np.c libpthread/thread/thr_resume_np.c
--- libpthread.orig/thread/thr_resume_np.c	Fri Apr 18 16:09:43 2003
+++ libpthread/thread/thr_resume_np.c	Sun May  4 22:03:31 2003
@@ -57,7 +57,7 @@
 
 			if ((curthread->state != PS_DEAD) &&
 			    (curthread->state != PS_DEADLOCK) &&
-			    ((curthread->flags & THR_FLAGS_EXITING) != 0))
+			    ((curthread->flags & THR_FLAGS_EXITING) == 0))
 				resume_common(thread);
 
 			/* Unlock the threads scheduling queue: */
@@ -107,6 +107,7 @@
 	 * now runnable but not in any scheduling queue.  Set the
 	 * state to running and insert it into the run queue.
 	 */
-	if (thread->state == PS_SUSPENDED)
+	if (thread->state == PS_SUSPENDED &&
+	    (thread->sflags & THR_FLAGS_IN_SYNCQ) == 0)
 		_thr_setrunnable_unlocked(thread);
 }
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030504223022.5335f30f.kaakun>