Re: Beachball on Lengthy Task
Re: Beachball on Lengthy Task
- Subject: Re: Beachball on Lengthy Task
- From: Stuart Malin <email@hidden>
- Date: Sat, 4 Apr 2009 17:45:06 -1000
On Apr 4, 2009, at 5:36 PM, Pierce Freeman wrote:
And, if you are 10.5 only, there's also NSObject's
performSelectorInBackground:withObject:
Is this a timer or a thread creator? I don't believe it has inputs
for the
time, or could it just do it automatically? Also, is there some way
I can
make this work with a function already created?
That is a thread creator. It will initiate the specified selector of
the receiver (the invoked object). You can pass a single object to it;
that object can, of course, contain references to other objects.
Please be careful to distinguish "method" from "function." If you
meant an Objective-C method, yes, it will work with that. If you meant
a C function, then no, it will not work, at least not directly, but in
such case it would be easy to create a method that called the function.
Note: as has already been pointed out, you must be very careful
regarding thread safety. A background thread task must carefully
constrain which objects it instantiates and methods used to those that
are thread safe. Certainly no U/I.
Read the cited references, and additional material germane to these.
btw: by any stretch of the imagination, I'm not an expert with threads.
_______________________________________________
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