adium 3825:79746d8f56e9: Clean up our loop check, and put the ma...

commits at adium.im commits at adium.im
Fri Apr 1 18:02:00 UTC 2011


details:	http://hg.adium.im/adium/rev/79746d8f56e9
revision:	3825:79746d8f56e9
branch:		AILoggerWithBlocks
author:		Stephen Holt <sholt at adium.im>
date:		Fri Apr 01 10:17:12 2011 -0700

Clean up our loop check, and put the main log indexing loop on a serial ioQueu, so we're not attempting to flush the index at the same time we're updating it.
Subject: adium 3826:d0acb3f4d09f: Correction: put the main indexing loop on the same queue as index flushing, and put file IO on the ioQueue.

details:	http://hg.adium.im/adium/rev/d0acb3f4d09f
revision:	3826:d0acb3f4d09f
branch:		AILoggerWithBlocks
author:		Stephen Holt <sholt at adium.im>
date:		Fri Apr 01 10:54:07 2011 -0700

Correction: put the main indexing loop on the same queue as index flushing, and put file IO on the ioQueue.
Subject: adium 3827:fd8847ab8685: rename searchIndexFlushingQueue to searchIndexQueue for accuracy

details:	http://hg.adium.im/adium/rev/fd8847ab8685
revision:	3827:fd8847ab8685
branch:		AILoggerWithBlocks
author:		Stephen Holt <sholt at adium.im>
date:		Fri Apr 01 11:00:45 2011 -0700

rename searchIndexFlushingQueue to searchIndexQueue for accuracy

diffs (78 lines):

diff -r cb6b736a7d0e -r fd8847ab8685 Source/AILoggerPlugin.m
--- a/Source/AILoggerPlugin.m	Tue Mar 22 21:11:57 2011 -0700
+++ b/Source/AILoggerPlugin.m	Fri Apr 01 11:00:45 2011 -0700
@@ -171,7 +171,7 @@
 static dispatch_queue_t     mainDispatchQueue;
 
 static dispatch_queue_t     dirtyLogSetMutationQueue;
-static dispatch_queue_t     searchIndexFlushingQueue;
+static dispatch_queue_t     searchIndexQueue;
 static dispatch_queue_t     activeAppendersMutationQueue;
 
 static dispatch_queue_t     ioQueue;
@@ -206,7 +206,7 @@
 	mainDispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
 	
 	dirtyLogSetMutationQueue = dispatch_queue_create("im.adium.AILoggerPlugin.dirtyLogSetMutationQueue", 0);
-	searchIndexFlushingQueue = dispatch_queue_create("im.adium.AILoggerPlugin.searchIndexFlushingQueue", 0);
+	searchIndexQueue = dispatch_queue_create("im.adium.AILoggerPlugin.searchIndexFlushingQueue", 0);
 	activeAppendersMutationQueue = dispatch_queue_create("im.adium.AILoggerPlugin.activeAppendersMutationQueue", 0);
 	logIndexingGroup = dispatch_group_create();
 	closingIndexGroup = dispatch_group_create();
@@ -319,7 +319,7 @@
 	self.xhtmlDecoder = nil;
 	
 	dispatch_release(dirtyLogSetMutationQueue); dirtyLogSetMutationQueue = nil;
-	dispatch_release(searchIndexFlushingQueue); searchIndexFlushingQueue = nil;
+	dispatch_release(searchIndexQueue); searchIndexQueue = nil;
 	dispatch_release(activeAppendersMutationQueue); activeAppendersMutationQueue = nil;
 	dispatch_release(logIndexingGroup); logIndexingGroup = nil;
 	dispatch_release(closingIndexGroup); closingIndexGroup = nil;
@@ -424,7 +424,7 @@
 	 */
 	[self _cancelClosingLogIndex];
 	__block __typeof__(self) bself = self;
-	dispatch_sync(searchIndexFlushingQueue, blockWithAutoreleasePool(^{
+	dispatch_sync(searchIndexQueue, blockWithAutoreleasePool(^{
 		SKIndexRef _index = nil;
 		if (!bself->logIndex) {
 			NSString  *logIndexPath = [bself _logIndexPath];
@@ -1423,9 +1423,9 @@
 		
 		AILogWithSignature(@"Cleaning %i dirty logs", [self.dirtyLogSet count]);
 		
-		dispatch_group_async(loggerPluginGroup, mainDispatchQueue, blockWithAutoreleasePool(^{
+		dispatch_group_async(loggerPluginGroup, searchIndexQueue, blockWithAutoreleasePool(^{
 			dispatch_group_enter(logIndexingGroup);
-			while (_remainingLogs && bself.indexingAllowed) {
+			while (_remainingLogs > 0 && bself.indexingAllowed) {
 				NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 				__block NSString *__logPath;
 				NSString  *logPath = nil;
@@ -1439,7 +1439,7 @@
 				logPath = [[__logPath copy] autorelease];
 				if (logPath) {
 					dispatch_semaphore_wait(jobSemaphore, DISPATCH_TIME_FOREVER);
-					dispatch_group_async(logIndexingGroup, mainDispatchQueue, blockWithAutoreleasePool(^{
+					dispatch_group_async(logIndexingGroup, ioQueue, blockWithAutoreleasePool(^{
 						CFRetain(searchIndex);
 						__block SKDocumentRef document = SKDocumentCreateWithURL((CFURLRef)[NSURL fileURLWithPath:logPath]);
 						if (document && bself.indexingAllowed) {
@@ -1500,7 +1500,7 @@
 				[bself _saveDirtyLogSet];
 			}
 			dispatch_group_leave(logIndexingGroup);
-			dispatch_group_notify(logIndexingGroup, searchIndexFlushingQueue, ^{
+			dispatch_group_notify(logIndexingGroup, searchIndexQueue, ^{
 				bself.indexIsFlushing = YES;
 				dispatch_async(dispatch_get_main_queue(), ^{
 					[[AILogViewerWindowController existingWindowController] logIndexingProgressUpdate];
@@ -1584,7 +1584,7 @@
 {
 	__block __typeof__(self) bself = self;
 	dispatch_group_wait(logIndexingGroup, DISPATCH_TIME_FOREVER);
-	dispatch_async(searchIndexFlushingQueue, ^{
+	dispatch_async(searchIndexQueue, ^{
 		if (bself->logIndex && bself.canCloseIndex) {
 			[bself _flushIndex:bself->logIndex];
 			SKIndexClose(bself->logIndex);




More information about the commits mailing list