略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Cond::create

2024-04-25

Cond::create

(PECL pthreads < 3.0.0)

Cond::create创建一个条件变量

Warning

pthreads v3 中已经将 Cond 类移除。

说明

final public static Cond::create ( void ) : int

创建一个条件变量。

参数

此函数没有参数。

返回值

指向条件变量的句柄。

范例

Example #1 条件变量的创建与销毁

<?php
/** 不可以使用 new 关键字,因为 Cond 不是 PHP 对象 **/
$cond Cond::create();
/** 现在你可以在任意线程上下文中使用此条件变量 **/
var_dump($cond);
/** 永远不要忘记销毁你创建的条件变量 **/
Cond::destroy($cond);
?>

以上例程会输出:

int(4540682)
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/cond.create.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3