Hello,

in FTP (available in GAP, http://gap.nongnu.org) I do inter-thread messaging with the precise goal to have threads perform operations on the main thread GUI operations.

I set up DO between the app itself this way:
   // we set up distributed objects
   port1 = [NSPort port];
   port2 = [NSPort port];
   kitConnection = [[NSConnection alloc] initWithReceivePort:port1
                                                    sendPort:port2];
   [kitConnection setRootObject:self];
/* Ports switched here. */
   portArray = [NSArray arrayWithObjects:port2, port1, nil];
   [NSThread detachNewThreadSelector: @selector(connectWithPorts:)
                            toTarget: [FtpClient class]
                          withObject: portArray];


inside "connectWithPorts" I do:

   serverConnection = [NSConnection
           connectionWithReceivePort:[portArray objectAtIndex:0]
                            sendPort:[portArray objectAtIndex:1]];
serverObject = [self alloc];
   [(id)[serverConnection rootProxy] setServer:serverObject];
   [serverObject release];
[[NSRunLoop currentRunLoop] run];


at this point DO is set up,

when the FtpClient class calls the controller, it will invoke its methods on the main thread.

It works for me both on Unix as on Windows.

Riccardo

Samantha Rahn wrote:
Does anyone have an example or a suggestion for implementing
inter-thread messaging using
performSelector:onThread:withObject:waitUntilDone:?  I am finding that
the implementation fails under windows and would like to see a working
example or any suggestions on how to make it work.

Any suggestions would be appreciated.
Sam


_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep




_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to