• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cleaner daemon managed by Launchd?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cleaner daemon managed by Launchd?


  • Subject: Re: Cleaner daemon managed by Launchd?
  • From: Michael Ash <email@hidden>
  • Date: Sat, 7 Mar 2009 23:38:08 -0500

On Sat, Mar 7, 2009 at 8:30 PM, Ken Thomases <email@hidden> wrote:
> 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.

And if they *really* do need to have a directory entry, your best bet
is probably to spawn a little subprocess when you create the files
that just sits and waits for its parent to die. Once the parent
disappears for any reason, it can delete the files.

Mike
_______________________________________________

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

  • Follow-Ups:
    • Re: Cleaner daemon managed by Launchd?
      • From: Olivier Palliere <email@hidden>
References: 
 >Cleaner daemon managed by Launchd? (From: Olivier Palliere <email@hidden>)
 >Re: Cleaner daemon managed by Launchd? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Trying to understand the cause of a "message sent to deallocated instance" error
  • Next by Date: NSTextView won't allow a Return (Enter)
  • Previous by thread: Re: Cleaner daemon managed by Launchd?
  • Next by thread: Re: Cleaner daemon managed by Launchd?
  • Index(es):
    • Date
    • Thread