• 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
simple AppKit / multithreading question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple AppKit / multithreading question


  • Subject: simple AppKit / multithreading question
  • From: AurĂ©lien HugelĂ© <email@hidden>
  • Date: Fri, 11 Mar 2005 14:44:45 +0100

Hi list !

my app is heavily multithreaded, and needs to modify the GUI. I know that the interface mods needs to be done in the main thread.
Its is very convenient to use performSelectorInMainThread: for my secondary threads... but still, i have a question :


most of my threads need to modify the enabled/disabled state or the hidden/shown state of my widgets. I use setEnabled:YES/NO or setHidden:YES/NO

but i can not use performSelectorInMainThread:withObject: here! the argument of this method must be NSObjects ... not BOOL !

i ask my self about several possibilities :

1/ adding a category to all my widgets : setEnabled:(NSNumber*)state and setHidden:(NSNumber*)state
=> can be very boring because i potentially need to create a category for all the API method that require a bool or an int or a float ...


2/ adding enable:(id)myWidget / disable:(id)myWidget methods to my code
=> i feel it is poor design... there must be a better cocoa native solution !?


3/ methods like setEnabled: or setHidden: are known to be thread safe, because internally they just set a boolean and call setNeedsDisplay... so there is no need to call the on the main thread...

Sorry for this very newbie question !

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: simple AppKit / multithreading question
      • From: "Dennis C. De Mars" <email@hidden>
    • Re: simple AppKit / multithreading question
      • From: James Housley <email@hidden>
  • Prev by Date: Re: Cocoa from C++ (dont want to mix it)
  • Next by Date: Re: Reading multi-frame TIFF's
  • Previous by thread: Re: memory problem with bi-directional referenced objects
  • Next by thread: Re: simple AppKit / multithreading question
  • Index(es):
    • Date
    • Thread