Re: Cleaner daemon managed by Launchd?
Re: Cleaner daemon managed by Launchd?
- Subject: Re: Cleaner daemon managed by Launchd?
- From: Ken Thomases <email@hidden>
- Date: Sat, 7 Mar 2009 19:30:55 -0600
On Mar 7, 2009, at 5:26 PM, Olivier Palliere wrote:
I am working on an application that once started, sets up some
temporary files and so. I didn't think of it at first, but I had the
case where a friend force quitted the application, and I was left
with the app not running, and still my temporary things hanging
around. Ultimately, this is ok, as a reboot will clear /tmp, but
ideally, I'd like to clear it up as soon as possible.
Do your temp files really need to remain listed in the file system?
You can open/create them and then unlink them. Your file descriptor
(or NSFileHandle) will remain valid and will be able to access and
manipulate the file data, but the file won't be listed in the file
system. When your process exits (cleanly or otherwise), the kernel
will make sure all of your file descriptors are closed. In this case,
because there are no more links to the file, the closing of the last
file descriptor to it will cause it to be deleted.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden