I would really recommend using the asynchronous APIs instead. It avoids bad
behaviors like polling. Your current loop means you’re using CPU time even when
no data is arriving, and can also waste up to 100ms sleeping when there’s data
to read. And these make canceling pretty trivial since you’re
On May 8, 2010, at 3:18 PM, Kenny Leung wrote:
> Hi All.
>
> I'm using CFNetwork APIs to create a cancellable web operation using the
> synchronous, non-blocking APIs like so:
[snip]
> This is fine once you've gotten to the point of pulling the response, but I
> would like the operation to a
Hi All.
I'm using CFNetwork APIs to create a cancellable web operation using the
synchronous, non-blocking APIs like so:
do {
bytesRead = 0;
if ( CFReadStreamHasBytesAvailable(inStream) ) {
bytesRead = CFReadStreamRead(inStream, buffer, sizeof(buffer));
if ( bytesRea