GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP flock? (https://gfy.com/showthread.php?t=439371)

Dusen 03-03-2005 07:09 AM

PHP flock?
 
Based on another thread I thought I'd ask this in a new one.

Is there any way using flock to 'queue' the file writes in php? All I see is examples how to say "can't get lock" and then die.

psili 03-03-2005 07:14 AM

I tried a quick google on it and didn't find anything. I suspect PHP would need to have a "threaded" process, where individual threads had a "wait until ready" state on the file lock, which I don't think PHP has. If it's doable though, I'd definitively like to know.

Dusen 03-08-2005 09:02 AM

Bump this thread

MickeyG 03-08-2005 09:05 AM

I dont know but you could try adding a sleep(1) then loop and try again

swedguy 03-08-2005 09:07 AM

Yeah put the lock in a while loop

swedguy 03-08-2005 09:09 AM

http://www.google.se/search?sourceid...hile+flock+php

examples

Dusen 03-08-2005 09:24 AM

Wicked guys, thanks.

According to this:

http://www.hudzilla.org/php/8_11_0.php

You don't even need to use a while loop?

Quote:

The file locking mechanism in PHP automatically makes processes queue up for their locks by default. For example, save this next script as flock.php:
I'll test it now.

psili 03-08-2005 09:26 AM

See. Sometimes this place does teach a person something.


All times are GMT -7. The time now is 12:23 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123