Re: NSPipe (NSFileHandle) writedata limit?
Re: NSPipe (NSFileHandle) writedata limit?
- Subject: Re: NSPipe (NSFileHandle) writedata limit?
- From: Greg Guerin <email@hidden>
- Date: Fri, 9 Apr 2010 18:32:32 -0700
McLaughlin, Michael P wrote:
aTask = [NSTask new];
...
myID = [NSString stringWithFormat:@"%d ", ident];
inPipe = [NSPipe pipe]; // i.e., input for subtask
outPipe = [NSPipe pipe];
If you aren't concurrently reading the output pipe from the child
process, then you can end up deadlocked. The buffer in each pipe is
only 16 KB (as measured empirically, not a guaranteed size).
Suppose the child process writes output to its end of the output
pipe. When the pipe buffer fills up because no one is reading the
other end, the child blocks. This will then stall any process that's
writing data to the child's input pipe, as soon as the input-pipe
buffer fills up.
The total amount of data it takes to cause deadlock depends on the
amount of input data, the amount of stream buffering done by the
child process (e.g. stdio FILE* buffers), and the amount of output
data generated.
Find where the child process is blocked. Or show more code.
-- GG
_______________________________________________
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