PHP code example of morris / sync
1. Go to this page and download the library: Download morris/sync library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
morris / sync example snippets
// 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' );