• 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: Multi-Threaded App Overview Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multi-Threaded App Overview Question


  • Subject: Re: Multi-Threaded App Overview Question
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 13 Aug 2002 19:12:20 -0700

On Tuesday, August 13, 2002, at 09:27 PM, Paul A. Seligman wrote:

Option 1: Every user action that requires talking to the server spawns a new thread, which attempts to communicate to the server, but is locked until the server socket is free. This has the benefits of being easy to code: Expect that I got my data back from my socket request, and update the UI on a successful response. This has the downside that I will be creating many threads, though I'd be surprised if any user could get more than two or three threads going at a time (most server request / responses have little data associated).

Option 2: Set up a communication thread when the program starts up, and set up a queue to handle server requests. This has the benefit that only one extra thread will be around. It has the downside that it makes it much more difficult to know what response I'm receiving, and makes it more difficult to keep the UI in sync with the server state.

You can also create a thread pool which is a mix of option 1 & 2 and bound how big this thread pool gets. It also avoids having to create threads again and again.

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

  • Prev by Date: Re: [TRTFM] mouseMove invoked on non-FrstResponder?
  • Next by Date: Tutorial for internationalization
  • Previous by thread: num lock effect on key events
  • Next by thread: Tutorial for internationalization
  • Index(es):
    • Date
    • Thread