/**
  * Test object destruction when passing to a threads constructor.
  *
  * @return void
  */
 public function testPassThroughThreadConstructor()
 {
     // set the counter to ZERO
     $this->object->counter = 0;
     // check the reference counter
     $this->assertSame(1, Registry::refCount($this->object));
     // initialize the mutex
     $mutex = \Mutex::create();
     // execute the thread
     $thread = new PassThroughConstructorThread($this->object, $mutex);
     $thread->start();
     $thread->join();
     // check the reference counter
     $this->assertSame(1, Registry::refCount($this->object));
 }
Beispiel #2
0
 /**
  * Returns the reference counter.
  *
  * @return integer The reference counter
  */
 public function __refCount()
 {
     return Registry::refCount($this);
 }