�������� pthreads v2���� pthreads v3 ���Ѿ����Ƴ���
pthreads �����д����Ϊ protected �� private �ķ������ṩ�����ʺ϶��̻߳����Ķ��� �������е� Threaded ����pthreads ������и�д������
Example #1 protected ����ʾ���� ���Ϊ protected �ķ�����ͬһʱ�������һ���̷߳���
<?php
class ExampleThread extends Thread {
public function run() {
/* thread code */
if ($this->synchronized()) {
}
}
protected function exclusive() {
/* synchronized method */
}
}
$thread = new ExampleThread();
if ($thread->start()) {
$thread->exclusive();
}
?>
Example #2 private ����ʾ�������Ϊ private �ķ���ֻ���ɴ����ö�����̵߳���
<?php
class ExampleThread extends Thread {
public function run() {
/* thread code */
if ($this->insideonly()) {
}
}
private function insideonly() {
/* private method */
}
}
$thread = new ExampleThread();
if ($thread->start()) {
$thread->insideonly();
}
?>