• 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: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry


  • Subject: Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry
  • From: Jaime Magiera <email@hidden>
  • Date: Tue, 25 Sep 2007 12:59:39 -0400


On Sep 25, 2007, at 9:21 AM, Alastair Houghton wrote:

It didn't. At least, unless you wrote a load of fancy code to asynchronously invoke -closeFile.

Then, I'm even more confused :) Closed means closed, right? If so, why the error?


There's no such thing. NSFileHandle is a wrapper around a system file handle. It doesn't have a "caching limit", or any buffering, except that provided by the system disk cache (which is below the filesystem, so other processes should be able to access data you've written almost immediately).

OK.

How large are the TIFF images?

I'm sorry, they are actually PNG images of only 8K. They are added in a loop and after each is added, synchronizeFile is called (see below).


What type of disk/filesystem is this file on?

These are all HFS+ (many with GUID partition tables).

Are you using threading at all in this program?

Yes, but quite a bit further up the chain. In other words, these particular methods are all on the same thread.


Or are you using NSFileHandle's asynchronous methods? If so, maybe you have a race condition of some sort?

The addImages method is called from the main export method. It is passed a NSString for the file path, which shortly into the method is used with [NSFileHandle fileForUpdatingAtPath:] to create the handle. There are some lines to open the image data into an NSData. That NSData is then passed with the file handle to another method ("appendData: withfileHandle:") which then appends the data to the file and calls [NSFileHandle synchronizeFile] before returning to addImages. After the return to addImages, there is creation of some smaller chunks of file data (TRAK atom) which is then added to the file with a "addAtom: withfileHandle:" method, which also calls [NSFileHandle synchronizeFile] (several times actually). After return to addImages a second time, [NSFileHandle closeFile] is called. addImages then returns to the initial calling method (export), which does the copy.


So, as you can see, I call synchronizeFile and closeFile explicitly in the process. I'm not sure what I'm doing wrong in this case.

Jaime Magiera
Sensory Research Network
http://www.sensoryresearch.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


References: 
 >Re: really weird move file problem (From: Cem Karan <email@hidden>)
 >Re: really weird move file problem (From: Jaime Magiera <email@hidden>)
 >Re: really weird move file problem (From: Jon Hendry <email@hidden>)
 >[resolved] Re: really weird move file problem -- bonus points to Jon Hendry (From: Jaime Magiera <email@hidden>)
 >Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry (From: Alastair Houghton <email@hidden>)
 >Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry (From: Jaime Magiera <email@hidden>)
 >Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry (From: Alastair Houghton <email@hidden>)

  • Prev by Date: NSTask -launch override
  • Next by Date: how to build finalcut-pro style gui apps?
  • Previous by thread: Re: [resolved] Re: really weird move file problem -- bonus points to Jon Hendry
  • Next by thread: Re: really weird move file problem
  • Index(es):
    • Date
    • Thread