Re: Managing Multiple Connections
Re: Managing Multiple Connections
- Subject: Re: Managing Multiple Connections
- From: "Duane Murphy" <email@hidden>
- Date: Wed, 21 May 2003 08:58:19 -0700
--- At Wed, 21 May 2003 01:05:43 -0700, Dietrich Epp wrote:
>
What is a good way to manage multiple connections (OSX)? Most of my
>
documentation is UNIX-specific, and my first thought was to create a
>
thread that manages all connections using the select(2) system call.
>
Unfortunately, this means that communication with the thread must
>
either be done using a timeout (ick), signals (double ick), or file
>
descriptors (ick squared). My second thought is to create a thread for
>
each connection, but this seems excessive.
Threads per connection is a black hole that many have fallen into.
Fundamentally it doesnot scale. As Quinn points out threads have an
overhead that must be accounted for.
Threads should be function based rather than connection based. Most code
that I have seen uses select() to manage the threads I believe. There are
some interesting techniques that can be used to get control of a thread
waiting in select.
Good luck,
...Duane
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.