Re: many messages between threads
Re: many messages between threads
- Subject: Re: many messages between threads
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 1 Sep 2007 18:57:11 +0200
On 1 Sep 2007, at 18:08, Adam R. Maxwell wrote:
On Sep 1, 2007, at 05:36, Gerriet M. Denkmann wrote:
I have a tree-like data structure which is displayed in an
NSBrowser and gets operated upon.
As these operations can take some time, they are done in another
thread.
In order to test the message speed I created a simpler case:
One object - called Main - lives in the main thread and another -
called Worker - lives in another thread.
Main has a method:
- (void)add: (NSNumber *)n { myInt += [ n intValue]; }
Worker has:
mainProxy an NSProxy for Main
mainDirect = Main (not a proxy)
If Worker does (in some loop)
[mainProxy add: [NSNumber numberWithInt: someInt ]];
this takes about 20 msec (iBook G4 800 MHz) per operation.
Make sure to use setProtocolForProxy: on mainProxy, if you haven't
already.
I have, but it makes no visible difference either way.
You could also declare add: as (oneway void) if your worker thread
doesn't depend on the result of that operation.
No. When I do this, I can no longer send messages to the worker
thread (like "terminate") while it is looping. And again, it doesn't
get faster.
Kind regards,
Gerriet.
_______________________________________________
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