diff options
author | Andreas Gampe <agampe@google.com> | 2014-07-22 21:40:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-07-22 16:35:00 +0000 |
commit | c836fcbb52d99efdd9ed4f5c104aebd0c37cb121 (patch) | |
tree | ed4850062a27c1d14f8cffd0216de4de939a1295 /test | |
parent | f645a02cc669232a33b2c2a3c309ed878615d4a9 (diff) | |
parent | 8d9044bb4039bfd46b20edce4cff929906e492c6 (diff) | |
download | art-c836fcbb52d99efdd9ed4f5c104aebd0c37cb121.zip art-c836fcbb52d99efdd9ed4f5c104aebd0c37cb121.tar.gz art-c836fcbb52d99efdd9ed4f5c104aebd0c37cb121.tar.bz2 |
Merge "Made sync-test actually wait for first thread to start."
Diffstat (limited to 'test')
-rw-r--r-- | test/050-sync-test/src/Main.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/050-sync-test/src/Main.java b/test/050-sync-test/src/Main.java index ec6d732..5364e2a 100644 --- a/test/050-sync-test/src/Main.java +++ b/test/050-sync-test/src/Main.java @@ -50,13 +50,14 @@ public class Main { one = new CpuThread(1); two = new CpuThread(2); - one.start(); - - try { - Thread.sleep(100); - } catch (InterruptedException ie) { - System.out.println("INTERRUPT!"); - ie.printStackTrace(); + synchronized (one) { + one.start(); + try { + one.wait(); + } catch (InterruptedException ie) { + System.out.println("INTERRUPT!"); + ie.printStackTrace(); + } } two.start(); @@ -101,6 +102,9 @@ class CpuThread extends Thread { //System.out.println(Thread.currentThread().getName()); synchronized (mSyncable) { + synchronized (this) { + this.notify(); + } for (int i = 0; i < 10; i++) { output(mNumber); } |