Updating ITFoundation to include updates spurred by Haven development.
[ITFoundation.git] / ITThreadChild.m
diff --git a/ITThreadChild.m b/ITThreadChild.m
new file mode 100644 (file)
index 0000000..4b2dd85
--- /dev/null
@@ -0,0 +1,23 @@
+#import "ITThreadChild.h"
+
+@implementation ITThreadChild
+
++ (void)runWithPorts:(NSArray *)portArray {
+       NSAutoreleasePool *pool;
+       NSConnection *parentConnection;
+       id childObject;
+       
+       pool = [[NSAutoreleasePool alloc] init];
+       
+       parentConnection = [NSConnection connectionWithReceivePort:[portArray objectAtIndex:0] sendPort:[portArray objectAtIndex:1]];
+       
+       childObject = [self alloc];
+       if ([(id <ITThreadParent>)[parentConnection rootProxy] registerThreadedChild:childObject]) {
+               [[NSRunLoop currentRunLoop] run];
+       }
+       
+       [childObject release];
+       [pool release];
+}
+
+@end