• 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: NSFileHandle and thread safety
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFileHandle and thread safety


  • Subject: Re: NSFileHandle and thread safety
  • From: Graham Cox <email@hidden>
  • Date: Tue, 26 Jul 2016 09:45:30 +1000

> On 26 Jul 2016, at 5:37 AM, Daniel Stenmark <email@hidden> wrote:
>
> 2. Can I read from a single file using two NSFileHandles on two threads at the same time?
>
> Why would you need to do that in the first place?  Unless you’re reading a single byte at a time, it sounds like a sure-fire way to get corrupted data, regardless of whether you’re using NSFileHandle or good old POSIX methods.  I don’t think there’s inherently dangerous about the operation itself, but the resulting data buffers are probably going to be gibberish.


Aren’t accesses to the file system serialised anyway? Use multiple threads to read a single file isn’t going to gain you anything, even if there wasn’t this coherency issue.

—Graham



_______________________________________________

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: 
 >NSFileHandle and thread safety (From: "J.E. Schotsman" <email@hidden>)
 >Re: NSFileHandle and thread safety (From: Daniel Stenmark <email@hidden>)

  • Prev by Date: Re: NSFileHandle and thread safety
  • Next by Date: Re: NSFileHandle and thread safety
  • Previous by thread: Re: NSFileHandle and thread safety
  • Next by thread: Re: NSFileHandle and thread safety
  • Index(es):
    • Date
    • Thread