Re: Clarification: What is exatly drawing inside a thread
Re: Clarification: What is exatly drawing inside a thread
- Subject: Re: Clarification: What is exatly drawing inside a thread
- From: Andreas Mayer <email@hidden>
- Date: Sun, 8 Feb 2004 07:24:10 +0100
Am 08.02.2004 um 05:46 schrieb Stefan Pantke:
From time to time some text-strings
were printed over and over - a over c over H, e.g.
What does that mean. Please clarify.
Isn't setStringValue simply setting some internal view value and
invalidating
the view? And isn't the on-screen updating done by the main thread?
I think so.
Now I inserted the [imageOutletOL lockFocusIfCanDraw] mechanism, which
seems to
solve the problem.
But why?
Probably because setStringValue: isn't an atomic operation and is not
thread safe. So without a lock you will have several threads that are
executing that method at the same time which might lead to all sorts of
problems.
Or more general: How to determine, which operations DRAW and which do
not?
I don't think this has anything to do with drawing at all.
Did you check what values the shared object actually holds? Try to log
them and see what you get. I guess it will be the same garbage you see
drawn to the screen.
In general, you always have to use locks when writing to shared
resources from more than one thread.
Anybody correct me if I got this wrong, please.
bye. Andreas.
_______________________________________________
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.