Comment detail

ワーカスレッドを安全に終了させるまで待機 (Nested Flatten)

This comment is reply for 4967 matyr: GNU Smalltalk に訳してみま...(ワーカスレッドを安全に終了させるまで待機). Go to thread root.

さらに Rhino で。

1
2
3
4
5
6
7
8
9
(function doukaku116(nThread){
  var out = new java.util.concurrent.ArrayBlockingQueue(nThread * 2);
  for(var i = nThread; i--;) spawn(function(secs){
    out.put('#start '+ (secs = Math.random() * 11 + 5 | 0));
    java.lang.Thread.sleep(secs * 1000);
    out.put('#stop  '+ secs);
  });
  for(i = nThread * 2; i--;) print(out.take());
})(5);

Index

Feed

Other

Link

Pathtraq

loading...