Re: Why multi-threading ?
Re: Why multi-threading ?
- Subject: Re: Why multi-threading ?
- From: Douglas Davidson <email@hidden>
- Date: Tue, 27 May 2003 10:22:07 -0700
On Tuesday, May 27, 2003, at 6:28 AM, Chris Hanson wrote:
There's another way to do this as well: Events. If your network stack
delivers events to your application code when things requiring its
attention happen, you can be single-threaded and also not poll.
This is how Open Transport worked on the classical Mac OS. It's also
the sort of API simulated using threads & blocking I/O behind the
scenes by many Cocoa facilities (-[NSFileHandle
readInBackgroundAndNotify] for example).
This is also the sort of API provided by CFSocket and CFNetwork. In
many cases it is possible to avoid creating additional threads for
networking by using one of these facilities. Also, there is a point to
the encapsulated abstraction they provide. For example, while it is
true that CFSocket is currently implemented using an additional private
thread, it is also possible that at some point in the future there will
be kernel support that will allow it to be implemented without this
additional thread. If that were to happen, then all clients would
benefit without having to alter any of their code.
Douglas Davidson
_______________________________________________
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.