summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-03-25 21:53:01 -0500
committerBrad Leege <bleege@gmail.com>2015-03-25 21:53:01 -0500
commitaa1eabe2305f5e44d573292bc965f63c85f96f40 (patch)
treeaaa228f567859be1fa83784375a3b56b1aaf808d
parentb06e8c8dfcdd6d75f07949e1256b4a2f8e6f552e (diff)
downloadqtlocation-mapboxgl-aa1eabe2305f5e44d573292bc965f63c85f96f40.tar.gz
#1109 - Converting pushEvent and flush to use actual serial queues that are dispatched asynchronously.
-rw-r--r--platform/ios/MGLMapboxEvents.m8
1 files changed, 6 insertions, 2 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index 838fd11d36..9ceac3902b 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -23,6 +23,8 @@
@property (atomic) NSString *anonid;
@property (atomic) NSTimer *timer;
@property (atomic) NSString *userAgent;
+@property (atomic) dispatch_queue_t serialqPush;
+@property (atomic) dispatch_queue_t serialqFlush;
@end
@@ -57,6 +59,8 @@ NSNumber *scale;
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsToRegister];
}
+ _serialqPush = dispatch_queue_create("SERIALQPUSH", DISPATCH_QUEUE_SERIAL);
+ _serialqFlush = dispatch_queue_create("SERIALQFLUSH", DISPATCH_QUEUE_SERIAL);
// Configure Events Infrastructure
_queue = [[NSMutableArray alloc] init];
@@ -132,7 +136,7 @@ NSNumber *scale;
return;
}
- dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
+ dispatch_async(_serialqPush, ^{
NSMutableDictionary *evt = [[NSMutableDictionary alloc] init];
// mapbox-events stock attributes
@@ -180,7 +184,7 @@ NSNumber *scale;
return;
}
- dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
+ dispatch_async(_serialqFlush, ^{
int upper = (int)_flushAt;
if (_flushAt > [_queue count]) {