summaryrefslogtreecommitdiffstats
path: root/macosx/HBDistributedArray.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2019-06-08 16:20:43 +0200
committerDamiano Galassi <[email protected]>2019-06-08 16:20:43 +0200
commitc36996ced365c839b01c5297d799ba79f1e05299 (patch)
treeb584d6a570d36def3f07ef7a4e8f7ae36ac0f64c /macosx/HBDistributedArray.m
parent908b78452f8e53b5a9de3a592949eb30b21a5ec5 (diff)
MacGui: write the queue to disk less often and add some validations when reading it back from disk.
Diffstat (limited to 'macosx/HBDistributedArray.m')
-rw-r--r--macosx/HBDistributedArray.m13
1 files changed, 12 insertions, 1 deletions
diff --git a/macosx/HBDistributedArray.m b/macosx/HBDistributedArray.m
index f92abfdf5..cac504456 100644
--- a/macosx/HBDistributedArray.m
+++ b/macosx/HBDistributedArray.m
@@ -167,7 +167,7 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
{
// Save changes to disk
// and unlock
- [self synchronize];
+ [self synchronizeIfNeeded];
[self unlock];
}
@@ -244,6 +244,17 @@ NSString *HBDistributedArraWrittenToDisk = @"HBDistributedArraWrittenToDisk";
}
/**
+ * Writes the changes to disk only if we aren't exiting a recursive lock
+ */
+- (void)synchronizeIfNeeded
+{
+ if (self.mutexCount == 1)
+ {
+ [self synchronize];
+ }
+}
+
+/**
* Writes the changes to disk
*/
- (void)synchronize