Fixed up thread handling.

CQTexperiment
vspader 2007-10-14 16:37:06 +00:00
parent 0091ccb447
commit 0e6f0a8576
1 changed files with 10 additions and 3 deletions

View File

@ -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;