29package com.jogamp.common.util;
31import java.io.IOException;
32import java.lang.reflect.InvocationTargetException;
34import org.junit.Assert;
37import com.jogamp.junit.util.SingletonJunitCase;
39import org.junit.FixMethodOrder;
40import org.junit.runners.MethodSorters;
42@FixMethodOrder(MethodSorters.NAME_ASCENDING)
46 public void testInvokeAndWait00() throws IOException, InterruptedException, InvocationTargetException {
47 final Object syncObject =
new Object();
48 final boolean[] done = {
false};
49 final Runnable clientAction =
new Runnable() {
51 synchronized(syncObject) {
52 System.err.println(
"CA.1: "+syncObject);
54 System.err.println(
"CA.X");
55 syncObject.notifyAll();
60 System.err.println(
"BB.0: "+syncObject);
61 synchronized (syncObject) {
62 System.err.println(
"BB.1: "+syncObject);
63 new InterruptSource.
Thread(
null, clientAction, Thread.currentThread().getName()+
"-clientAction").start();
65 System.err.println(
"BB.2");
67 System.err.println(
"BB.3");
68 }
catch (
final InterruptedException e) {
69 throw new RuntimeException(e);
71 Assert.assertTrue(done[0]);
72 System.err.println(
"BB.X");
77 public void testInvokeAndWait01() throws IOException, InterruptedException, InvocationTargetException {
78 final boolean[] done = {
false};
79 final Runnable clientAction =
new Runnable() {
81 System.err.println(
"CA.1");
83 System.err.println(
"CA.X");
93 System.err.println(
"BB.2");
95 System.err.println(
"BB.3");
96 }
catch (
final InterruptedException e) {
97 throw new RuntimeException(e);
99 Assert.assertTrue(done[0]);
100 System.err.println(
"BB.X");
104 public static void main(
final String args[])
throws IOException {
106 org.junit.runner.JUnitCore.
main(tstname);
java.lang.Thread specialization implementing InterruptSource to track java.lang.Thread#interrupt() ca...
Helper class to provide a Runnable queue implementation with a Runnable wrapper which notifies after ...
final Object getSyncObject()
Return the synchronization object if any.
void testInvokeAndWait01()
static void main(final String args[])
void testInvokeAndWait00()
Interface exposing java.lang.Thread#interrupt() source, intended for java.lang.Thread specializations...