• 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: NSStream blocking behavior?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStream blocking behavior?


  • Subject: Re: NSStream blocking behavior?
  • From: email@hidden (Stefan Haller)
  • Date: Thu, 8 May 2008 09:58:04 +0200
  • Organization: Ableton

Michael Ash <email@hidden> wrote:

> NSStream matches the semantics of the UNIX read/write calls. In both
> cases, if you are informed that data or space is available, you can
> issue a read or write for an arbitrary amount of data and be
> guaranteed that it will not block.

I would have thought so too, but the NSStream documentation seems to
disagree (this is from the "Stream Programming Guide for Cocoa"
document):

: It should be pointed out that neither the polling nor run-loop
: scheduling approaches are airtight defenses against blocking. If the
: NSInputStream hasBytesAvailable method or the NSOutputStream
: hasSpaceAvailable method returns NO, it means in both cases that the
: stream definitely has no available bytes or space. However, if either
: of these methods returns YES, it can mean that there is available
: bytes or space or that the only way to find out is to attempt a read
: or a write operation (which could lead to a momentary block). The
: NSStreamEventHasBytesAvailable and NSStreamEventHasSpaceAvailable
: stream events have identical semantics.

I'm not sure exactly what "momentary block" means here.


--
Stefan Haller
Ableton
http://www.ableton.com/
_______________________________________________

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: NSStream blocking behavior?
      • From: Michael Gardner <email@hidden>
References: 
 >Re: NSStream blocking behavior? (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Threading - How its done?
  • Next by Date: Quadratic curves in NSBezierPath
  • Previous by thread: Re: NSStream blocking behavior?
  • Next by thread: Re: NSStream blocking behavior?
  • Index(es):
    • Date
    • Thread