So why doesn't it work???

On Aug 13, 2012, at 7:08 PM, Ken Thomases wrote:

> On Aug 13, 2012, at 5:09 PM, Jens Alfke wrote:
> 
>> On Aug 13, 2012, at 2:17 PM, Charlie Dickman <3tothe...@comcast.net> wrote:
>> 
>>>     int vmDataLength = 0;
>>>     do {
>>>             vmData = [vmRead availableData];
>>>             vmDataLength = [vmData length];
>>>     } while (vmDataLength != 0);
>> 
>> Don't you mean "== 0" on the final line?
>> Also, spin-loops like this are a really bad idea — this loop is going to 
>> consume something like 100% CPU. If you have to loop like this, run the 
>> current run loop in between tests.
> 
> This isn't a spin loop and he has the termination condition correct.  
> -[NSFileHandle availableData] blocks if there's no data available.  It 
> returns a zero-length NSData on end-of-file.
> 
> Regards,
> Ken
> 

Charlie Dickman
3tothe...@comcast.net




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to