Flock and file deletion



I am wondering if this is possible. I have a file that is accessed by
multiple users and keeps track of activity (the file is polled by
flash every 2 seconds). As users leave, the flash program tells the
php program to remove them from the activity file, and as users access
this activity file, users who have timed out (haven't been heard from
in 60 seconds) are removed. Using a combination of flock, microsecond
sleeps, loops and the flash file repolling if it doesn't get a
completed result back, I have been able to keep anyone from stepping
on each other.

The question I have is, when the last user exits, I want to delete the
file, but am afraid that the file deletion may step on a user just
coming in and remove their activity. I had the thought of, and this
may be totally stupid, to open the file for read, flock it and delete
it while open. The theory behind this is that the flock would stay
active till the php script ended and the file handle was closed. At
which point the other waiting user would be able to access the file
for writing. Does this make sense?

Bill H
.



Relevant Pages

  • Re: Flock and file deletion
    ... the flash program tells the ... php program to remove them from the activity file, ... Using a combination of flock, ...
    (comp.lang.php)
  • Re: Flock and file deletion
    ... the flash program tells the ... php program to remove them from the activity file, ... Using a combination of flock, ...
    (comp.lang.php)
  • Re: Flock and file deletion
    ... Bill H wrote: ... the flash program tells the ... Using a combination of flock, ...
    (comp.lang.php)
  • Re: Flock and file deletion
    ... multiple users and keeps track of activity (the file is polled by ... the flash program tells the ... Using a combination of flock, ... Erwin Moller ...
    (comp.lang.php)
  • Re: No boot after SP2-now what?
    ... Check with the laptop manufacturer about how to flash that BIOS. ... When you are ready for SP-2, follow the Service Pack Installation ... > copied the flash program to the C: drive when in Recovery but I ...
    (microsoft.public.windowsupdate)