|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2002-05-03 05:37 UTC] AlberT at SuperAlberT dot it
 sem_acquire() function has this behavior: After processing a request, any semaphores acquired by the process but not explicitly released will be released automatically and a warning will be generated. This is not a great thing, infact in this way the readers/writers classical IPC problem, with writers precedence is impossible to implement !!! I think an option to disable autorelease is usefull. (I sent a feature/change request, but I had no feadback :-( ) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
Some people write me for explanations..... ok I'll be more clear I hope: READER: p(mutex); readcount++; if (readcount is 1) then p(db); v(mutex); CRITICAL REGION where we read p(mutex); readcount--; if (readcount is 0) then v(db); v(mutex); WRITER: p(db); CRITICAL REGION where we write v(db); this is the simplest r/w problem, ok ?!? let we analize it now. we have to acquire some mutex to protect owr access to variables readcount ok ?? This is possible in PHP! .. ok ! now, I'm the 1st reader .. I acquire sem DB becouse readcount is equal to 1, I release mutex and begin to READ NOW IT IS possible that an other reader arrive and it is faster than me; it DON'T acquire DB becouse readcont is now 2, it READS and DOESN'T HAVE to release sem DB becouse readcount IS NOT 1 (reader 1 is still reading !!)... PHP AUTORELEASE DB ... damn !!!