Re: Thread safety of Cocoa Bindings
Re: Thread safety of Cocoa Bindings
- Subject: Re: Thread safety of Cocoa Bindings
- From: John Stiles <email@hidden>
- Date: Tue, 6 Dec 2005 13:47:51 -0800
It's difficult to "test" for thread-safety. Many threading problems
are very rare in practice, or only occur with a certain sequence of
calls which your code may not be making. If something isn't
documented as thread-safe, I would absolutely avoid it in threaded code.
On Dec 6, 2005, at 12:25 PM, Felix Schwarz wrote:
I just wanted to know the same myself, so I did a small benchmark,
that just invokes a method that does nothing (and do that a
thousand times).
This is the result:
Measuring 1000 x 'performSelectorOnMainThread:' ..
Required time 0.07031 for 1000 loops, average: 0.00007
This is on a dual G5 1.8 GHz. But, unless you have dozens and
dozens updates to do, this really seems neglectable.
Thanks to some private email exchange with Olivier Gillet I also
had to learn that NSObjectController seems to behave in a thread-
unsafe manner. The more I'm surprised that NSArrayController did
behave thread-safe in my tests.
Felix
The advice given to me was: use performInMainThread, and that
works pretty well for me, and it's easy to use.
That would be the safe way to go.
hello !
One question : how big is performInMainThread's overhead ?
Let's say there are a few dozen updates per second, for example ?
thanks !
--
Felix Schwarz
email@hidden
Postal address:
IOSPIRIT GmbH, Berckhauser Straße 11, 90409 Nürnberg, Germany
Phone: +49 (0)911 / 3677 423
Fax: +49 (0)911 / 3677 424
Homepage: http://www.iospirit.com/
Trade register number and place of registration:
HRB 21960, Amtsgericht Nürnberg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden