From 454074538253cfccd936286adca97c1e5635c16c Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Fri, 9 Aug 2013 15:08:05 -0700 Subject: [PATCH] Fix the dead thread bug on iOS 5 (fix #466) --- SDWebImage/SDWebImageDownloaderOperation.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SDWebImage/SDWebImageDownloaderOperation.m b/SDWebImage/SDWebImageDownloaderOperation.m index 6c765027..b7890ebd 100644 --- a/SDWebImage/SDWebImageDownloaderOperation.m +++ b/SDWebImage/SDWebImageDownloaderOperation.m @@ -71,7 +71,9 @@ [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:self]; // Make sure to run the runloop in our background thread so it can process downloaded data - CFRunLoopRun(); + // Note: we use a timeout to work around an issue with NSURLConnection cancel under iOS 5 + // not waking up the runloop, leading to dead threads (see https://github.com/rs/SDWebImage/issues/466) + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 10, false); } else {