From: Stefan Ring Date: Mon, 3 Mar 2008 21:10:14 +0000 (+0100) Subject: * .hgignore: Ignoring class files. X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=cacao.git;a=commitdiff_plain;h=7ce37d716a8ca130491bd37dc23636c3705a3048 * .hgignore: Ignoring class files. * tests/threads: New directory for thread tests. * tests/threads/threadInterrupt.java: Moved. --HG-- rename : tests/threadInterrupt.java => tests/threads/threadInterrupt.java --- diff --git a/.hgignore b/.hgignore index 44e2528b9..5f82c8d89 100644 --- a/.hgignore +++ b/.hgignore @@ -50,3 +50,4 @@ tests/regression/resolving/*.class tests/regression/resolving/classes1/*.class tests/regression/resolving/classes2/*.class tests/regression/resolving/classes3/*.class +tests/threads/*.class diff --git a/tests/threadInterrupt.java b/tests/threadInterrupt.java deleted file mode 100644 index ef4108379..000000000 --- a/tests/threadInterrupt.java +++ /dev/null @@ -1,71 +0,0 @@ -public class threadInterrupt { - public static class firstthread implements Runnable { - private threadInterrupt s; - - public firstthread(threadInterrupt s_) { - s = s_; - } - public void run() { - try { - synchronized (s.o1) { - System.out.println("first thread!"); - Thread.sleep(500); - System.out.println("interrupting"); - s.t2.interrupt(); - System.out.println("leaving"); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public static class secondthread implements Runnable { - private threadInterrupt s; - - public secondthread(threadInterrupt s_) { - s = s_; - } - public void run() { - try { - Thread.sleep(250); - synchronized (s.o1) { - System.out.println("second thread!"); - s.o1.wait(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public Object o1 = new Object(); - public Thread t1 = null; - public Thread t2 = null; - - public static void main(String args[]) { - System.out.println("should exit with java.lang.InterruptedException"); - threadInterrupt s = new threadInterrupt(); - firstthread r1 = new firstthread(s); - secondthread r2 = new secondthread(s); - - s.t1 = new Thread(r1, "a"); - s.t2 = new Thread(r2, "b"); - s.t1.start(); - s.t2.start(); - } -} - -/* - * These are local overrides for various environment variables in Emacs. - * Please do not remove this and leave it at the end of the file, where - * Emacs will automagically detect them. - * --------------------------------------------------------------------- - * Local variables: - * mode: java - * indent-tabs-mode: t - * c-basic-offset: 4 - * tab-width: 4 - * End: - * vim:noexpandtab:sw=4:ts=4: - */ diff --git a/tests/threads/threadInterrupt.java b/tests/threads/threadInterrupt.java new file mode 100644 index 000000000..ef4108379 --- /dev/null +++ b/tests/threads/threadInterrupt.java @@ -0,0 +1,71 @@ +public class threadInterrupt { + public static class firstthread implements Runnable { + private threadInterrupt s; + + public firstthread(threadInterrupt s_) { + s = s_; + } + public void run() { + try { + synchronized (s.o1) { + System.out.println("first thread!"); + Thread.sleep(500); + System.out.println("interrupting"); + s.t2.interrupt(); + System.out.println("leaving"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public static class secondthread implements Runnable { + private threadInterrupt s; + + public secondthread(threadInterrupt s_) { + s = s_; + } + public void run() { + try { + Thread.sleep(250); + synchronized (s.o1) { + System.out.println("second thread!"); + s.o1.wait(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public Object o1 = new Object(); + public Thread t1 = null; + public Thread t2 = null; + + public static void main(String args[]) { + System.out.println("should exit with java.lang.InterruptedException"); + threadInterrupt s = new threadInterrupt(); + firstthread r1 = new firstthread(s); + secondthread r2 = new secondthread(s); + + s.t1 = new Thread(r1, "a"); + s.t2 = new Thread(r2, "b"); + s.t1.start(); + s.t2.start(); + } +} + +/* + * These are local overrides for various environment variables in Emacs. + * Please do not remove this and leave it at the end of the file, where + * Emacs will automagically detect them. + * --------------------------------------------------------------------- + * Local variables: + * mode: java + * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + * vim:noexpandtab:sw=4:ts=4: + */