Re: User-space threads and NSAutoreleasePool
Re: User-space threads and NSAutoreleasePool
- Subject: Re: User-space threads and NSAutoreleasePool
- From: Jeremy Pereira <email@hidden>
- Date: Thu, 18 Mar 2010 11:07:54 +0000
On 18 Mar 2010, at 06:41, BJ Homer wrote:
> On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin <email@hidden> wrote:
> doing one transaction updating 400-500 records.) Hence, we pipeline the HTTP
> requests, starting transfer of the second before the first one is finished.
> There are a large number of servers that don't handle pipelining, but we'll
> only we talking to one particular server, and we know it does.
> NSURLConnection does not (according to various mailing list messages)
> implement pipelining, allegedly due to the lack of server support. There's
> some suggestion that CFHTTPStream does support pipelining, but there's
> little to no documentation about it, and I don't know if it will handle 500
> at once.
It seems to me that you can accomplish what you want using just two normal threads.
Open a TCP connection to port 80 on the server
Create a read thread and a write thread.
The write thread takes all the requests passed to it and writes them to the TCP connection using synchronous IO as fast as the connection will accept data. After each request has been written, the thread puts it in an "awaiting response" queue.
The read thread reads the TCP connection using synchronous IO and deserialises the responses as they come in. for each response, it takes the first request off the "awaiting response" queue and deals with it.
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden