Re: Threadsafe function help
Re: Threadsafe function help
- Subject: Re: Threadsafe function help
- From: Michael Ash <email@hidden>
- Date: Fri, 1 May 2009 12:04:41 -0400
On Fri, May 1, 2009 at 1:21 AM, Ken Tozier <email@hidden> wrote:
>
> On May 1, 2009, at 12:59 AM, Michael Ash wrote:
>
>> "It locks up" is not a very useful description. Use the debugger and
>> find out *where* it locks up.
>
> I bracket calls to my KCLog function like so
> NSLog(@"about to call KCLog");
> KCLog(@"testing 1, 2, 3");
> NSLog(@"KCLog exe OK");
>
> And what I see in the Xcode console is:
> about to call KCLog
>
> and that's it. It never make it to "KCLog exe OK"
Again, not very useful. You could be anywhere within that large KCLog
function. Use the *debugger* and find out exactly where it's locked
up.
>> I'll wager it's due to your manipulation of GUI objects in that last
>> method you posted, though. GUI objects can *only* be manipulated from
>> the main thread. You apparently know about this, because you dump your
>> append calls onto the main thread using performSelectorOnMainThread:,
>> but you fail to do this for a bunch of other calls, like length and
>> scrollRangeToVisible:.
>
> I could see where scrollRangeToVisible might cause a problem, but wouldn't
> "length" be OK since it is just reading a value, not changing it?
Absolutely not. It might update a cache, or trigger lazy evaluation of
something, or just read an object that's being changed elsewhere.
Rather than repeat a lengthy discussion, I recommend you read this:
http://www.mikeash.com/?page=pyblog/friday-qa-2009-01-09.html
Mike
_______________________________________________
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