Re: Bindings Cocoa and new Thread (Spinning Beach Ball an new Thread)
Re: Bindings Cocoa and new Thread (Spinning Beach Ball an new Thread)
- Subject: Re: Bindings Cocoa and new Thread (Spinning Beach Ball an new Thread)
- From: Stefan Werner <email@hidden>
- Date: Wed, 4 Jun 2008 16:47:17 -0700
On Jun 4, 2008, at 4:10 PM, Alexander Hartner wrote:
1.) I gathered i have to create a new NSAutoReleasePool in my
"threaded" method. Is this correct ?
Yes, every thread needs a separate AutoReleasePool. I don't know from
the top of my head if NSThread creates one for you (I usually use
pthreads and there you have to create your own).
2.) During execution of this I am updating the UI components from a
thread which is not the main thread. This produces several error
messages. How can I updated UI components. I tried using
performSelectorOnMainThread, but this didn't work either. Not sure
if this is the right approach.
Basic rule of threading on OS X: don't do any UI stuff whatsoever
outside of the main thread.
3.) Is there an alternative way to achieve this without the beach
ball appearing. I understand what caused it was the fact that I
never exited the action method, at least not quickly. I would prefer
an approach which did not require a new thread to be created.
Are you using blocking sockets to talk to the remote server? If so,
using non-blocking sockets can help you do the entire communication
based on events instead of polling.
-Stefan
_______________________________________________
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