[kaffe] CVS kaffe (guilhem): Solaris' thread system needs a yield here.

Kaffe CVS cvs-commits at kaffe.org
Mon Jun 13 06:19:38 PDT 2005


PatchSet 6642 
Date: 2005/06/13 13:13:10
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Solaris' thread system needs a yield here.

Members: 
	ChangeLog:1.4168->1.4169 
	test/regression/Preempt.java:INITIAL->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4168 kaffe/ChangeLog:1.4169
--- kaffe/ChangeLog:1.4168	Mon Jun 13 12:23:36 2005
+++ kaffe/ChangeLog	Mon Jun 13 13:13:10 2005
@@ -1,5 +1,9 @@
 2005-06-13  Guilhem Lavaux  <guilhem at kaffe.org>
 
+	* test/regression/Preempt.java: Added a 'yield' for Solaris.
+
+2005-06-13  Guilhem Lavaux  <guilhem at kaffe.org>
+
 	* config/sparc/jit.h: FRAMEOBJECT get the real enclosing object (and
 	not the second one).
 
===================================================================
Checking out kaffe/test/regression/Preempt.java
RCS:  /home/cvs/kaffe/kaffe/test/regression/Preempt.java,v
VERS: 1.4
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/test/regression/Preempt.java	Mon Jun 13 13:19:38 2005
@@ -0,0 +1,49 @@
+public class Preempt implements Runnable
+{
+    public final static int TIMEOUT = 5000;
+
+    public static void main(String args[])
+    {
+	new Thread() {
+	    public void run() {
+		try {
+		    Thread.sleep(TIMEOUT);
+		} catch (InterruptedException _) {
+		    ;
+		}
+		System.exit(0);
+	    }
+	}.start();
+
+	for (int i = 0; i < 5; i++)
+	    new Thread(new Preempt(), "thread " + i).start();
+
+	synchronized(Preempt.class) {
+	    System.out.println("started 5 threads");
+	}
+    }
+
+    public void run()
+    {
+	// this shouldn't be necessary---System.out.println should be
+	// synchronized, but it apparently is (9/30/99)
+	synchronized(Preempt.class) {
+	    System.out.println(Thread.currentThread().getName());
+	}
+	while (true) {
+		// Apparently, Solaris is needing this to reschedule sub-thread.
+		Thread.yield();
+		continue;
+	}
+    }
+}
+
+// Sort output
+/* Expected Output:
+started 5 threads
+thread 0
+thread 1
+thread 2
+thread 3
+thread 4
+*/




More information about the kaffe mailing list