Re: Cocoa really needs to be thread-safe
Re: Cocoa really needs to be thread-safe
- Subject: Re: Cocoa really needs to be thread-safe
- From: "Philippe C.D. Robert" <email@hidden>
- Date: Sat, 2 Nov 2002 19:36:49 +0100
On Saturday, November 2, 2002, at 03:00 Uhr, Andy wrote:
Steve Klingsporn wrote:
If Cocoa is Apple's "next-generation framework solution," then I
expect
to see Apple correct these issues.
Is there, infact, a GUI toolkit on the market for desktop OSes which is
entirely threadsafe?
I don't know and I am not even sure that it would make sense. Let me
explain this a bit. Making a toolkit threadsafe means creating (some
noticeable) overhead resulting in annoying performance impacts. Hence
it is usually better to analyse the problem and provide a product which
can be used in a multi threaded environment rather than going for the
brute force solution from the start.
Steve Klingsporn wrote:
Using NSEvents and posting them to the main thread is a hack.
A hack that breaks down quickly when the main event loop is busy.
I do not agree, I believe that it does make indeed good sense to use
NSEvents for interthread communication - this is the common way of
dealing with the problem and design wise very elegant and effective.
The world is asynchronous and threaded. Performance of a multithreaded
app using NSEvents to get the job done when the main thread is busy is
like holding down a menu on Mac OS 9 when trying to do something else.
Abysmal.
To me this sounds like the application design is suboptimal then. Why
is the main thread so busy? Are you not using other threads for doing
the "hard work" then? How many threads are you using on how many CPUs?
As you say, the world is asynchronous and threaded, but writing code
which runs optimal on multiple CPUs is not just a matter of using locks
and barriers and the sort all over the place...
In general I think Cocoa provides us with all means required to write
multi threaded applications and furthermore it is thread safe where it
is critical.
-Phil
--
Philippe C.D. Robert
http://www.nice.ch/~phip
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.