I am not getting an error; it just hangs.

*** code ***
@interface Subtask : NSObject {
   NSTask *aTask;
   NSPipe *inPipe, *outPipe;
   NSFileHandle *sendEnd, *readEnd;
   NSString *myID;
}

-(void)sendData:(void*)data numBytes:(NSUInteger)sz taskTag:(NSString*)tag;
...

@end

// in implementation
    aTask = [NSTask new];
...
   myID = [NSString stringWithFormat:@"%d ", ident];
   inPipe = [NSPipe pipe];     // i.e., input for subtask
  outPipe = [NSPipe pipe];
   sendEnd = [inPipe fileHandleForWriting];
   readEnd = [outPipe fileHandleForReading];

...

-(void)sendData:(void*)data numBytes:(NSUInteger)sz taskTag:(NSString*)tag
{
   NSData *dataset = [NSData dataWithBytes:data length:sz];
   NSNumber *num = [NSNumber numberWithUnsignedInteger:sz];
   NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: num, 
@"size", nil];
   [sendEnd writeData:dataset];    // Do NOT close the fileHandle!
  [[NSDistributedNotificationCenter defaultCenter] postNotificationName:tag 
object:myID userInfo:dict];
}

*** end code ***

My main thread has an NSArray of Subtasks and sends data to each via

  Npending = numProcessors;
   for (k = 0;k < numProcessors;k++) {
      Subtask  *aTask = [myTask objectAtIndex:k];
      [aTask sendData:&theData numBytes:sz taskTag:@"aTag"];
   }

If sz < 65536, this works; otherwise it hangs at

[sendEnd writeData:dataset];

Note: GC is supported.

On 4/9/10 12:29 PM, "Dave Keck" <davek...@gmail.com> wrote:

After re-reading your message, I think I misunderstood your problem.
Nonetheless, a quick test program doesn't run into the mentioned 65k
limit (at least on my machine):

    http://pastie.org/911738

Still though, what error are you getting?



--
Mike McLaughlin
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to