summaryrefslogtreecommitdiff
path: root/test/files/run/testblock.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/testblock.scala')
-rw-r--r--test/files/run/testblock.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/files/run/testblock.scala b/test/files/run/testblock.scala
new file mode 100644
index 0000000000..a334b668fd
--- /dev/null
+++ b/test/files/run/testblock.scala
@@ -0,0 +1,33 @@
+
+
+
+
+import scala.parallel._
+
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ if (util.Properties.isJavaAtLeast("1.6")) {
+ val vendor = util.Properties.javaVmVendor
+ if ((vendor contains "Sun") || (vendor contains "Apple")) blockcomp(10)
+ }
+ }
+
+ val lock = new java.util.concurrent.locks.ReentrantLock
+
+ def blockcomp(n: Int): Unit = if (n > 0) {
+ val (x, y) = par(blockcomp(n - 1), blockcomp(n - 1))
+ if (n == 8) blocking { // without this blocking block, deadlock occurs
+ lock.lock()
+ }
+ x()
+ y()
+ if (n == 8) {
+ lock.unlock()
+ }
+ }
+
+}