Revision: 4245
http://skim-app.svn.sourceforge.net/skim-app/?rev=4245&view=rev
Author: hofman
Date: 2008-07-17 20:58:52 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
Better solution, use a separate flag to stop the server thread run loop set in
the DO message.
Modified Paths:
--------------
trunk/SKPDFSynchronizer.h
trunk/SKPDFSynchronizer.m
Modified: trunk/SKPDFSynchronizer.h
===================================================================
--- trunk/SKPDFSynchronizer.h 2008-07-17 20:57:10 UTC (rev 4244)
+++ trunk/SKPDFSynchronizer.h 2008-07-17 20:58:52 UTC (rev 4245)
@@ -56,6 +56,7 @@
id serverOnServerThread;
NSConnection *mainThreadConnection;
NSConnection *localThreadConnection;
+ BOOL stopRunning;
struct SKServerFlags *serverFlags;
}
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2008-07-17 20:57:10 UTC (rev 4244)
+++ trunk/SKPDFSynchronizer.m 2008-07-17 20:58:52 UTC (rev 4245)
@@ -114,11 +114,13 @@
localThreadConnection = nil;
serverOnMainThread = nil;
serverOnServerThread = nil;
-
+
serverFlags = NSZoneCalloc(NSDefaultMallocZone(), 1, sizeof(struct
SKServerFlags));
serverFlags->shouldKeepRunning = 1;
serverFlags->serverReady = 0;
+ stopRunning = NO;
+
// run a background thread to connect to the remote server
// this will connect back to the connection we just set up
[NSThread detachNewThreadSelector:@selector(runDOServerForPorts:)
toTarget:self withObject:[NSArray arrayWithObjects:port2, port1, nil]];
@@ -181,7 +183,7 @@
- (oneway void)stopRunning {
// not really necessary, as the main thread should already have done this
- OSAtomicCompareAndSwap32Barrier(1, 0, (int32_t
*)&serverFlags->shouldKeepRunning);
+ stopRunning = YES;
}
- (void)runDOServerForPorts:(NSArray *)ports {
@@ -212,7 +214,7 @@
[pool release];
pool = [NSAutoreleasePool new];
didRun = [rl runMode:NSDefaultRunLoopMode beforeDate:[NSDate
distantFuture]];
- } while ([self shouldKeepRunning] && didRun);
+ } while (stopRunning == NO && didRun);
}
@catch(id exception) {
NSLog(@"Discarding exception \"[EMAIL PROTECTED]" raised in object
%@", exception, self);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit