• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Clarification: What is exatly drawing inside a thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Clarification: What is exatly drawing inside a thread
      • From: Glen Low <email@hidden>
References: 
 >Clarification: What is exatly drawing inside a thread (From: Stefan Pantke <email@hidden>)

  • Prev by Date: Re: Drawing onto NSImageView subclass (Newbie)
  • Next by Date: Re: Clarification: What is exatly drawing inside a thread
  • Previous by thread: Clarification: What is exatly drawing inside a thread
  • Next by thread: Re: Clarification: What is exatly drawing inside a thread
  • Index(es):
    • Date
    • Thread