Re: Multi-Threaded App Overview Question
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.