Hi Nick.

You can't sleep the thread. According to the documentation for - [NSThread sleepForTimeInterval:], "No run loop processing occurs while the thread is blocked.". You need to run the run loop for the connection to process.

On an unrelated note, your use of "self->connection", etc., is non- standard and not advised. You should be using direct ivar access "connection", properties "self.connection", or accessor methods "[self connection]".

-Jeff


On Apr 29, 2009, at 11:31 PM, Nick Hristov wrote:

- (void) downloadData
{
   NSLog([self->connection description]);
   NSLog(@"run, b*$#4rd, run...");
   [self->connection scheduleInRunLoop:[NSRunLoop currentRunLoop]
forMode:NSDefaultRunLoopMode];
   [self->connection start];
   int timeout = 30;
   int i = 0;
while(self->finished == NO && [self _deletegateTerminateCheck] == NO) {
       // suspend thread
       [NSThread sleepForTimeInterval: 1.0];
       i++;

       /// stupid, but effective safety measure:
       if(i >= timeout) {
           break;
       }
   }
}

_______________________________________________

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

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

Reply via email to