• 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: setNeedsDisplay: thread safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setNeedsDisplay: thread safe?


  • Subject: Re: setNeedsDisplay: thread safe?
  • From: lbland <email@hidden>
  • Date: Thu, 8 Apr 2004 18:48:47 -0400

On Apr 8, 2004, at 6:32 PM, Mike R. Manzano wrote:

So, from an auxiliary thread, something like

[ myView performSelectorOnMainThread:@selector( setNeedsDisplay: )
withObject:YES
waitUntilDone:NO ] ;

Is "YES" a valid object to be passing?

hi-

Nope.

Don't know exactly what you are doing, but this is what I might do:

put this in your controller class:

+ (void)setNeedsDisplayOnMainThread:(id)object
{
[object setNeedsDisplay:YES];
}

then call it like this:

[MyController performSelectorOnMainThread:@selector( setNeedsDisplayOnMainThread: )
withObject:myView
waitUntilDone:NO ] ;

or if you want add setNeedsDisplayOnMainThread: in a category of NSView as a instance method and call it like:

[myView performSelectorOnMainThread:@selector( setNeedsDisplayOnMainThread: )
withObject:myView
waitUntilDone:NO ] ;

but assigning as a instance method isn't good because it is a stateless method.

again, I don't know your system design, and run loops, threading, etc. use need your system level design understanding, so I can't say for sure. You might want a "display controller", and there are also other ways that might be better depending on what you need.

good luck!

thanks!-

-lance
_______________________________________________
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.


References: 
 >setNeedsDisplay: thread safe? (From: "Mike R. Manzano" <email@hidden>)
 >Re: setNeedsDisplay: thread safe? (From: "Mike R. Manzano" <email@hidden>)

  • Prev by Date: Re: Best way to obtain the width of a piece of text?
  • Next by Date: Re: Objective-C++
  • Previous by thread: Re: setNeedsDisplay: thread safe?
  • Next by thread: Launch Services problems on Panther (long)
  • Index(es):
    • Date
    • Thread