• 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: Interrupt copyItemAtPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interrupt copyItemAtPath


  • Subject: Re: Interrupt copyItemAtPath
  • From: "gMail.com" <email@hidden>
  • Date: Mon, 08 Nov 2010 17:36:49 +0100
  • Thread-topic: Interrupt copyItemAtPath

I have verified that the waiting loop

    while(!gFileCopiedDone && !mUserPressedStop){
         CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5.0, true);
    }

slows down the copy speed 3 times and more. I can't use that.
I have to copy a hierarchical list of files, and let the user make his
choice if a problem occurs during the copy of each file.
Is a different way to get a value returned at each file copied?

Something like
    if(stage == kFSOperationStageComplete){
        go and copy the next file
    }

would make me redesign all of my code...
So it doesn't sound as the best solution for me.

--
Leo


> Da: Sherm Pendley <email@hidden>
> Data: Sun, 7 Nov 2010 19:33:26 -0500
> A: "gMail.com" <email@hidden>
> Cc: Ken Thomases <email@hidden>, <email@hidden>
> Oggetto: Re: Interrupt copyItemAtPath
>
> On Sun, Nov 7, 2010 at 6:06 PM, gMail.com <email@hidden> wrote:
>>
>> A quick question more please.
>> As I have seen on the Apple sample code "FSFileOperation",
>> I can wait until FSCopyObjectAsync is done, using CFRunLoopRunInMode.
>>
>>        while(!gFileCopiedDone && !mUserPressedStop){
>>            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5.0, true);
>>        }
>>        if(mUserPressedStop){
>>            FSFileOperationCancel(fileOp);
>>            return -12;
>>        }
>>
>> The user can press a button and set mUserDidStop = YES;
>> and I set the gFileCopiedDone to YES in the callback method,
>> when stage == kFSOperationStageComplete
>>
>> Since I have several files to copy, one by one, this way I can better manage
>> each single copy. Everything seems to work flawlessly. But, I ask, do you
>> think it's ok with the Mac standards? I mean, I have checked and the menu
>> works, the other apps work... Could this waiting loop cause some problem?
>
> Since the menu works - what happens if the user quits the app? You
> might want to call FSFileOperationCancel() then too, to make sure the
> partial copy gets cleaned up before your app exits.
>
> sherm--
>
> --
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net


_______________________________________________

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: Interrupt copyItemAtPath
      • From: Kyle Sluder <email@hidden>
References: 
 >Re: Interrupt copyItemAtPath (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Synchronizing iOS redraw
  • Next by Date: Re: Calling getter on const object
  • Previous by thread: Re: Interrupt copyItemAtPath
  • Next by thread: Re: Interrupt copyItemAtPath
  • Index(es):
    • Date
    • Thread