1. 首页
  2. 考试认证
  3. 其它
  4. syncPHP的同步函数调用实现与应用

syncPHP的同步函数调用实现与应用

上传者: 2024-12-19 17:10:41上传 ZIP文件 4.06KB 热度 6次

PHP同步


// Call a function in a mutually exclusive way using a lockfile.

// A process will only block other processes and never block itself,

// so you can safely nest synchronized operations.

Sync::call(function () {

    // do critical stuff like IO here

});



// Set default lockfile

Sync::$lock = 'my/default/.lock';



// Use different lockfile by passing it as the second argument

Sync::

下载地址
用户评论