function testJoinAll()
 {
     $thread1 = new TestThread(array('Hallo', 'Welt'));
     $thread2 = new TestThread(array('Eins', 'Zwei', 'Drei'));
     Thread::joinAll();
     $this->assertTrue(in_array('Hallo', self::$result));
     $this->assertTrue(in_array('Welt', self::$result));
     $this->assertTrue(in_array('Eins', self::$result));
     $this->assertTrue(in_array('Zwei', self::$result));
     $this->assertTrue(in_array('Drei', self::$result));
 }
 public function readNextGroup($maxDistanceGroup)
 {
     if ($this->serverPool == null) {
         // see __construct
         return $this->bookListArray;
     }
     if ($maxDistanceGroup == 0) {
         Thread::joinAll();
         return $this->bookListArray;
     }
     while ($this->hasServer($maxDistanceGroup) && !count($this->bookListArray)) {
         $this->startNextQueries();
         Thread::joinAll();
     }
     return $this->bookListArray;
 }