Topic awaiting preservation: can someone explain the flock function to me? |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: NJ |
posted 07-15-2002 11:57
i read about it in the php manual but they dont explain it that well. can someone elaborate more please? |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 07-15-2002 12:52
hm. not that I ever used it... |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 07-15-2002 15:04
So say you are writing a counter program that increments a text file after each visit. |
Paranoid (IV) Inmate From: NJ |
posted 07-16-2002 00:39
aaaaaaaaaaaahah! thank you so much. now see that makes much more sense. you're the php masta warmage |
Bipolar (III) Inmate From: Michigan |
posted 07-18-2002 01:02
yes but remember.... flock is an ADVISORY lock... meaning programs do NOT have to use it..... so a program can modify a file that you flocked even though you have it locked..... that is why you should make all your programs use it. |
Bipolar (III) Inmate From: Michigan |
posted 07-18-2002 01:04
forgot this though.... it locks the ENTIRE file.... if you do database programming like i do..... lower level.... the fcntl is a lot better... it allows you to flock just a "part" of your file... that way other programs can modify other parts |