aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-20 23:35:47 +0000
committerrowanbeentje <rowan@beent.je>2009-11-20 23:35:47 +0000
commit72d3441ba97d2dcdadfaac1012cb5c8868897e03 (patch)
tree96de46eb48e4d9b25de2905f443e102437aa7d3a /Frameworks/MCPKit
parentdcaa35d218ad66e61eeba0bac5a767f9a206f0b3 (diff)
downloadsequelpro-72d3441ba97d2dcdadfaac1012cb5c8868897e03.tar.gz
sequelpro-72d3441ba97d2dcdadfaac1012cb5c8868897e03.tar.bz2
sequelpro-72d3441ba97d2dcdadfaac1012cb5c8868897e03.zip
- Keep a buffer of at least one full row between the downloading and processing rows - eg don't process the newly downloaded rows at once - as a workaround for Issue #463
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
index 4fde472d..008dd870 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m
@@ -161,8 +161,11 @@
copiedDataLength = 0;
// Check to see whether we need to wait for the data to be availabe
- // - if so, wait 1ms before checking again
- while (!dataDownloaded && processedRowCount == downloadedRowCount) {
+ // - if so, wait 1ms before checking again.
+ // Keep the data processing thread at least one full row behind the download
+ // thread - this aids memory issues across the threads and prevents occasional
+ // race condition crashes.
+ while (!dataDownloaded && (processedRowCount + 2 > downloadedRowCount)) {
usleep(1000);
}
@@ -326,7 +329,7 @@
while (1) {
- // Check to see whether we need to wait for the data to be availabe
+ // Check to see whether we need to wait for the data to be available
// - if so, wait 1ms before checking again
while (!dataDownloaded && processedRowCount == downloadedRowCount) usleep(1000);