From 28a6dfca3de804ca4d41375d458c9ed42cf746ff Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Wed, 1 Dec 2004 18:34:54 +0000 Subject: re PR libgcj/18699 (SIGSEGV in GC_local_gcj_malloc) 2004-12-01 Bryce McKinlay PR libgcj/18699 * testsuite/libjava.lang/PR18699.java, testsuite/libjava.lang/PR18699.out: New test. From-SVN: r91573 --- libjava/testsuite/libjava.lang/PR18699.java | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 libjava/testsuite/libjava.lang/PR18699.java (limited to 'libjava/testsuite/libjava.lang/PR18699.java') diff --git a/libjava/testsuite/libjava.lang/PR18699.java b/libjava/testsuite/libjava.lang/PR18699.java new file mode 100644 index 0000000..6f81e10 --- /dev/null +++ b/libjava/testsuite/libjava.lang/PR18699.java @@ -0,0 +1,36 @@ +// Test for thread-local allocation problems. + +import java.util.HashMap; +import java.util.Observable; +import java.util.Observer; + +class PR18699 extends Observable implements Runnable, Observer { + + public static void main(String[] args) throws InterruptedException { + PR18699 PR18699_1 = new PR18699(); + PR18699 PR18699_2 = new PR18699(); + PR18699_1.addObserver(PR18699_2); + PR18699_2.addObserver(PR18699_1); + new Thread(PR18699_1).start(); + new Thread(PR18699_2).start(); + } + + public void run() { + int c = 0; + String s = ""; + while (++c < 50) { + this.setChanged(); + s = ""; + for (int i = 0; i < 200; i++) + s += String.valueOf(i); + this.notifyObservers(s); + } + } + + HashMap map = new HashMap(); + + public void update(Observable o, Object obj) + { + map.put(o, obj); + } +} -- cgit v1.1