note 76000 added to function.sem-get

From: Date: Tue, 26 Jun 2007 11:21:47 +0000
Subject: note 76000 added to function.sem-get
Groups: php.notes 
Request: Send a blank email to php-notes+get-127980@lists.php.net to get a copy of this message
Be aware that there is no way to ensure that you have exclusive access to a lock, despite setting max_acquire=1. In example, <? $fp = sem_get(fileinode('lock_file', 100); sem_acquire($fp); $fp2 = sem_get(fileinode('lock_file', 1); sem_acquire($fp2); ?> This will not block on the second sem_aquire. Therefore, if you have functions or processes that utilize shared locks (>1 max_acquire) you will still need to provide a seperate lock mechanism (ie flock) for write access, making the sem_ functions useless. Some more info, in flock, each reference to the lock file has it's own options (can be shared exclusive blocking non blocking etc), but apparently php's sem functions only support these options per semaphore, not per semaphore-reference. ---- Server IP: 66.207.199.35 Probable Submitter: 204.112.176.136 ---- Manual Page -- http://www.php.net/manual/en/function.sem-get.php Edit -- https://master.php.net/note/edit/76000 Del: integrated -- https://master.php.net/note/delete/76000/integrated Del: useless -- https://master.php.net/note/delete/76000/useless Del: bad code -- https://master.php.net/note/delete/76000/bad+code Del: spam -- https://master.php.net/note/delete/76000/spam Del: non-english -- https://master.php.net/note/delete/76000/non-english Del: in docs -- https://master.php.net/note/delete/76000/in+docs Del: other reasons-- https://master.php.net/note/delete/76000 Reject -- https://master.php.net/note/reject/76000 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127980) next »