From 72d3441ba97d2dcdadfaac1012cb5c8868897e03 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Fri, 20 Nov 2009 23:35:47 +0000 Subject: - 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 --- Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 9 ++++++--- 1 file 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); -- cgit v1.2.3