• 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: MVC and thread-safety
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MVC and thread-safety


  • Subject: Re: MVC and thread-safety
  • From: Mike Shields <email@hidden>
  • Date: Sun, 3 Nov 2002 15:16:46 -0700

Updating the score NSTextFields, of which there are 2 for each player, overlaid atop each other to provide the "etched" look atop my brushed metal textured window...[snip]...sometimes for some reason, they get a little visually out of sync, and the illusion is blown.

This isn't supported since overlapping NSViews isn't supported in Cocoa. Doesn't matter whether or not your threading, it's just not supported.

As for your threading issues, it seems like it would be simple enough to set up your own message queue between the two threads for the types of operations you want to do. Just accept the fact that Java doesn't have the richness of ObjC for accessing Cocoa and move on. With ObjC, you could use DO to do what you wanted. with Java, you would probably be best off stuffing the updated strings into a NSLocked NSArray acting as a queue. Send an event telling the main thread to empty the queue. If you have more than one item in the queue, pull them all out, if you have nothing, ignore the event.

As far as updating the UI and having the main thread ignore all of your messages sent from a secondary thread while the user's holding down the mouse button, well that's just a good idea. How would you like it if a dialog popped up in your face while you were moving a text view with the scroll-thumb, or while selecting and dragging in the field? Letting the user finish what they're doing before you interrupt them is just good program manners.

Mike
_______________________________________________
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: MVC and thread-safety
      • From: Steve Klingsporn <email@hidden>
    • Re: MVC and thread-safety
      • From: Scott Anguish <email@hidden>
References: 
 >Re: MVC and thread-safety (From: Steve Klingsporn <email@hidden>)

  • Prev by Date: Re: I want a scrollbar
  • Next by Date: Re: advice on filtering TreeNode objects
  • Previous by thread: Re: MVC and thread-safety
  • Next by thread: Re: MVC and thread-safety
  • Index(es):
    • Date
    • Thread