note 129025 added to function.flock
| From: | andy at andyslife dot org | Date: | Thu, 09 Nov 2023 17:20:34 +0000 |
| Subject: | note 129025 added to function.flock | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220981@lists.php.net to get a copy of this message | ||
Important if using this to lock a class into a single instance (long duration processes). The file
handle needs to be a class wide variable like $this->singleinstance. Not local to the __construct
function like $localvariable. The reason is the local variable is gone after __construct is called
so the lock lasts for only millisconds and not for the full duration of class running in memory.
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 96.73.43.1)
----
Manual Page -- https://php.net/manual/en/function.flock.php
Edit -- https://main.php.net/note/edit/129025
Del: integrated -- https://main.php.net/note/delete/129025/integrated
Del: useless -- https://main.php.net/note/delete/129025/useless
Del: bad code -- https://main.php.net/note/delete/129025/bad+code
Del: spam -- https://main.php.net/note/delete/129025/spam
Del: non-english -- https://main.php.net/note/delete/129025/non-english
Del: in docs -- https://main.php.net/note/delete/129025/in+docs
Del: other reasons-- https://main.php.net/note/delete/129025
Reject -- https://main.php.net/note/reject/129025
Search -- https://main.php.net/manage/user-notes.php