• 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: Stop NSFileManager copyFile in progress? Can you kill a thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stop NSFileManager copyFile in progress? Can you kill a thread?


  • Subject: Re: Stop NSFileManager copyFile in progress? Can you kill a thread?
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Mon, 10 Nov 2008 18:25:43 -0800


On Nov 10, 2008, at 1:45 PM, David wrote:

I have NSFIleManager copying files in a secondary thread. The user can
select to cancel the copy.
Is there a way to force NSFileManager to stop copying a file? The
files could be of arbitrary size. A large file could take quite a
while to end. I currently check if the thread has been cancelled
between files, but I can't figure out how to stop it if its in the
middle of copying one file.

Is there a way to make NSFileManager stop a copy operation?
Is there a way to forcibly kill a thread and thereby stop NSFileManager?

Killing the thread is generally not a good solution, even if you can work it out with pthread functions. In your case, I'd switch to the Carbon File Manager [1] and its asynchronous copying functions. Specifically, look at FSCopyObjectAsync or FSPathCopyObjectAsync, which can evidently be cancelled with FSFileOperationCancel (I'm not sure if you also have to use FSFileOperationUnscheduleFromRunLoop).


--
Adam

[1] http://developer.apple.com/documentation/Carbon/Reference/File_Manager/Reference/reference.html

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Stop NSFileManager copyFile in progress? Can you kill a thread? (From: David <email@hidden>)

  • Prev by Date: Re: Floating point pixel data / image handling confusion
  • Next by Date: Distributed Objects, proxy NSDistantObjects over-retained on OSX 10.5?
  • Previous by thread: Stop NSFileManager copyFile in progress? Can you kill a thread?
  • Next by thread: Re: Stop NSFileManager copyFile in progress? Can you kill a thread?
  • Index(es):
    • Date
    • Thread