Fixes illegal behavior of UnicodeSupport during multi-threaded build

This commit is contained in:
konsoletyper 2014-02-28 14:31:22 +04:00
parent cc8d2b8903
commit 723ad74f2e
2 changed files with 3 additions and 2 deletions

View File

@ -30,7 +30,7 @@ import org.teavm.common.IntegerArray;
*/ */
public class UnicodeSupport { public class UnicodeSupport {
private static AtomicBoolean filled = new AtomicBoolean(); private static AtomicBoolean filled = new AtomicBoolean();
private static volatile CountDownLatch latch = new CountDownLatch(0); private static volatile CountDownLatch latch = new CountDownLatch(1);
private static int[] digitValues; private static int[] digitValues;
private static void parseUnicodeData() { private static void parseUnicodeData() {
@ -130,6 +130,7 @@ public class UnicodeSupport {
private static void ensureUnicodeData() { private static void ensureUnicodeData() {
if (filled.compareAndSet(false, true)) { if (filled.compareAndSet(false, true)) {
parseUnicodeData(); parseUnicodeData();
latch.countDown();
latch = null; latch = null;
} else { } else {
CountDownLatch latchCopy = latch; CountDownLatch latchCopy = latch;

View File

@ -85,7 +85,7 @@
</goals> </goals>
<phase>process-test-classes</phase> <phase>process-test-classes</phase>
<configuration> <configuration>
<minifying>false</minifying> <minifying>true</minifying>
<numThreads>1</numThreads> <numThreads>1</numThreads>
<scanDependencies>true</scanDependencies> <scanDependencies>true</scanDependencies>
<outputDir>${project.build.directory}/javascript-tck</outputDir> <outputDir>${project.build.directory}/javascript-tck</outputDir>