morris/sync

PHP的同步函数调用

v1.0.0 2015-01-05 16:15 UTC

This package is auto-updated.

Last update: 2024-09-09 01:43:53 UTC


README

<?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::call( $func, 'my/other/.lock' );

需求

  • PHP 5.3+

安装

composer包名为morris/sync。您也可以下载或分支仓库。

许可证

Sync遵循MIT许可证。有关详细信息,请参阅LICENSE.md