Fixed up thread handling.
parent
0091ccb447
commit
0e6f0a8576
|
@ -35,8 +35,14 @@
|
|||
|
||||
[request release];
|
||||
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
NSDate* endDate = [NSDate distantFuture];
|
||||
do
|
||||
{
|
||||
NSLog(@"IN THREAD");
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate];
|
||||
} while (!_connectionFinished);
|
||||
|
||||
NSLog(@"Exiting thread");
|
||||
}
|
||||
|
||||
- (NSDictionary *)properties
|
||||
|
@ -62,7 +68,6 @@
|
|||
- (int)read:(void *)buffer amount:(int)amount
|
||||
{
|
||||
while (amount > [_data length] && !_connectionFinished) {
|
||||
NSLog(@"Waiting: %@", [NSThread currentThread]);
|
||||
[_sem timedWait: 2];
|
||||
}
|
||||
|
||||
|
@ -96,6 +101,8 @@
|
|||
|
||||
- (void)close
|
||||
{
|
||||
_connectionFinished = YES;
|
||||
|
||||
[_connection cancel];
|
||||
[_connection release];
|
||||
_connection = nil;
|
||||
|
|
Loading…
Reference in New Issue