Cond::wait

(PECL pthreads < 3.0.0)

Cond::wait锟饺达拷

Warning

pthreads v3 锟斤拷锟窖撅拷锟斤拷 Cond 锟斤拷锟狡筹拷锟斤拷

说锟斤拷

final public static Cond::wait ( int $condition , int $mutex [, int $timeout ] ) : bool

锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟饺达拷状态锟斤拷通锟斤拷 timeout 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫等达拷锟斤拷时时锟戒。

锟斤拷锟斤拷

condition

通锟斤拷锟斤拷锟斤拷 Cond::create() 锟斤拷锟斤拷锟斤拷玫锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

mutex

通锟斤拷锟斤拷锟斤拷 Mutex::create() 锟斤拷锟斤拷锟斤拷玫幕锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷丫锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷叱碳锟斤拷锟斤拷锟�

timeout

锟饺达拷锟斤拷时锟斤拷锟皆猴拷锟斤拷为锟斤拷位锟斤拷

锟斤拷锟斤拷值

锟斤拷锟斤拷值锟斤拷锟斤拷示锟斤拷锟斤拷锟角凤拷晒锟斤拷锟�

锟斤拷锟斤拷

Example #1 锟饺达拷锟斤拷锟斤拷锟斤拷锟斤拷

<?php
/** 锟斤拷注锟解,锟斤拷示锟斤拷锟结导锟铰斤拷锟教癸拷锟斤拷 **/
$mutex Mutex::create(true);
/** 锟斤拷锟斤拷锟斤拷使锟斤拷 new 锟截硷拷锟街o拷锟斤拷为 Cond 锟斤拷锟斤拷 PHP 锟斤拷锟斤拷 **/
$cond Cond::create();
/** The caller must lock the associated Mutex before a call to broadcast **/
var_dump(Cond::wait($cond$mutex));
/** 锟斤拷远锟斤拷要锟斤拷锟斤拷锟斤拷锟斤拷锟姐创锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 **/
Cond::destroy($cond);
Mutex::unlock($mutex);
Mutex::destroy($mutex);
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

int(49685473)