note 118933 added to function.flock

From: Date: Tue, 01 Mar 2016 14:49:43 +0000
Subject: note 118933 added to function.flock
Groups: php.notes 
Request: Send a blank email to php-notes+get-205078@lists.php.net to get a copy of this message
If you are interested in using file locking as indicator that your console app is running and you don't want to start it again: if (!flock($fp, LOCK_EX | LOCK_NB, $wouldblock)) { if ($wouldblock) { //Another process holds the lock! } else { //Couldn't lock for another reason, e.g. no such file } } else { //Lock obtained startJob(); } Please note that this is platform independent solution, but you have restrictions in PHP version (5.5.22 on Windows). Also, some old file systems are not supported. ---- Server IP: 72.52.91.14 Probable Submitter: 85.94.126.16 ---- Manual Page -- http://php.net/manual/en/function.flock.php Edit -- https://master.php.net/note/edit/118933 Del: integrated -- https://master.php.net/note/delete/118933/integrated Del: useless -- https://master.php.net/note/delete/118933/useless Del: bad code -- https://master.php.net/note/delete/118933/bad+code Del: spam -- https://master.php.net/note/delete/118933/spam Del: non-english -- https://master.php.net/note/delete/118933/non-english Del: in docs -- https://master.php.net/note/delete/118933/in+docs Del: other reasons-- https://master.php.net/note/delete/118933 Reject -- https://master.php.net/note/reject/118933 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205078) next »