summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorjsturm <jsturm@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-31 02:13:46 +0000
committerjsturm <jsturm@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-31 02:13:46 +0000
commit7de608327fe64b982b5b766e45c37c4a512390c4 (patch)
tree507f2774bc175d505d54b0a9d2490e5152c27688 /libjava
parent0030e8eccb358c1767899d17cad81dc8021cc17e (diff)
downloadgcc-7de608327fe64b982b5b766e45c37c4a512390c4.tar.gz
* libjava.lang/SyncTest.java: New file.
* libjava.lang/SyncTest.out: New file. * libjava.lang/SyncTest.xfail: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44495 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/testsuite/ChangeLog6
-rw-r--r--libjava/testsuite/libjava.lang/SyncTest.java31
-rw-r--r--libjava/testsuite/libjava.lang/SyncTest.out1
-rw-r--r--libjava/testsuite/libjava.lang/SyncTest.xfail1
4 files changed, 39 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index 8889313c124..ae3101f7e45 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-30 Jeff Sturm <jsturm@one-point.com>
+
+ * libjava.lang/SyncTest.java: New file.
+ * libjava.lang/SyncTest.out: New file.
+ * libjava.lang/SyncTest.xfail: New file.
+
2001-07-27 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* lib/libjava.exp (${tool}_set_ld_library_path): New, copied from
diff --git a/libjava/testsuite/libjava.lang/SyncTest.java b/libjava/testsuite/libjava.lang/SyncTest.java
new file mode 100644
index 00000000000..7cb6a56d397
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/SyncTest.java
@@ -0,0 +1,31 @@
+// Test atomic increment via synchronized blocks.
+public class SyncTest implements Runnable {
+ static int counter;
+
+ public void run() {
+ for (int n = 0; n < 1000000; n++)
+ synchronized (SyncTest.class) {
+ counter++;
+ }
+ }
+
+ public static void main(String[] args) {
+ SyncTest test = new SyncTest();
+ Thread[] thr = new Thread[4];
+
+ for (int n = 0; n < thr.length; n++) {
+ thr[n] = new Thread(test);
+ thr[n].start();
+ }
+
+ for (int n = 0; n < thr.length; n++) {
+ try {
+ thr[n].join();
+ } catch (InterruptedException ex) {
+ }
+ }
+
+ System.out.println(counter == 1000000 * thr.length ?
+ "ok" : "fail: " + counter);
+ }
+}
diff --git a/libjava/testsuite/libjava.lang/SyncTest.out b/libjava/testsuite/libjava.lang/SyncTest.out
new file mode 100644
index 00000000000..9766475a418
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/SyncTest.out
@@ -0,0 +1 @@
+ok
diff --git a/libjava/testsuite/libjava.lang/SyncTest.xfail b/libjava/testsuite/libjava.lang/SyncTest.xfail
new file mode 100644
index 00000000000..3f95317a450
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/SyncTest.xfail
@@ -0,0 +1 @@
+need-threads