Fix deadlock from trying to do a dispatch_sync on the main queue when already on the main thread
This commit is contained in:
parent
1e0bce2ba9
commit
bea04f4978
@ -993,9 +993,14 @@ static const NSUInteger AFMultipartBodyStreamProviderBufferSize = 4096;
|
||||
_outputStream = CFBridgingRelease(writeStream);
|
||||
|
||||
_outputStream.delegate = self;
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
if([NSThread isMainThread]) {
|
||||
[_outputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode];
|
||||
});
|
||||
}
|
||||
else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
[_outputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode];
|
||||
});
|
||||
}
|
||||
[_outputStream open];
|
||||
_keepalive = self;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user