Skip to content

Instantly share code, notes, and snippets.

@roscius
Last active March 15, 2016 00:06
Show Gist options
  • Select an option

  • Save roscius/1b7de702db71a2ace2e6 to your computer and use it in GitHub Desktop.

Select an option

Save roscius/1b7de702db71a2ace2e6 to your computer and use it in GitHub Desktop.

Revisions

  1. roscius revised this gist Mar 15, 2016. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Flock.php
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    <?php

    $f = fopen('lock', 'w') or die ('Cannot create lock file');
    if (flock($f, LOCK_EX | LOCK_NB)) {
    // yay
    }
    }

  2. roscius revised this gist Mar 15, 2016. No changes.
  3. roscius created this gist Mar 15, 2016.
    4 changes: 4 additions & 0 deletions Flock.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    $f = fopen('lock', 'w') or die ('Cannot create lock file');
    if (flock($f, LOCK_EX | LOCK_NB)) {
    // yay
    }