Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: NSTask interactive question



On 11/29/06, Chris Suter <email@hidden> wrote:

On 30/11/2006, at 9:45 AM, Shawn Erickson wrote:

> On 11/29/06, Chris Suter <email@hidden> wrote:
>>
>> One thing to be wary of (although it might not occur in your
>> case), is that
>> both writeData and availableData can block if there isn't
>> sufficient buffer
>> space.
>
> How can availableData block if the pipe it is reading from becomes
> full?

You're quite right, obviously it can't. It can block when there is no
data. Anyway, that's irrelevant. My point still stands, I believe you
could still get the deadlock: writeData blocks on a full buffer &
puts or stdout.flush in Ruby blocks waiting on a full buffer.

Correct a deadlock potential exists because they are waiting on each other to drain their respective output pipes... for that to happen would require one to get ahead of the other or for one to write out a large enough amount of data before being fully able to drain its input pipe.

This type of issue can be addressed by read in background
functionality or by using two threads in his application (one to fill
the pipe and the other to drain the pipe).

-Shawn
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSTask interactive question (From: Matt Neuburg <email@hidden>)
 >Re: NSTask interactive question (From: "Shawn Erickson" <email@hidden>)
 >Re: NSTask interactive question (From: Chris Suter <email@hidden>)
 >Re: Re: NSTask interactive question (From: "Shawn Erickson" <email@hidden>)
 >Re: NSTask interactive question (From: Chris Suter <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.