From 29cd6b49789cb4b39beb107e4721948dc9c2cfa4 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Thu, 26 Mar 2015 23:00:57 -0700 Subject: [PATCH] convention cleanups for main thread variable; use class method --- platform/ios/MGLMapboxEvents.m | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index 5ecbbb6d2..39470a97f 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -55,7 +55,6 @@ NSString *const MGLEventMapLocation = @"Location"; @property (atomic) NSString *iOSVersion; @property (atomic) NSString *carrier; @property (atomic) NSUInteger flushAt; -@property (atomic) NSTimeInterval flushAfter; @property (atomic) NSDateFormatter *rfc3339DateFormatter; @property (atomic) CGFloat scale; @@ -63,6 +62,10 @@ NSString *const MGLEventMapLocation = @"Location"; // @property (nonatomic) NSTimer *timer; +// The flush expiration time is only ever accessed from the main thread. +// +@property (nonatomic) NSTimeInterval flushAfter; + // This is an array of events to push. All access to it will be // from our own serial queue. // @@ -344,11 +347,11 @@ NSString *const MGLEventMapLocation = @"Location"; } // Start New Timer - NSTimeInterval interval = _flushAfter; - _timer = [NSTimer scheduledTimerWithTimeInterval:interval - target:self + _timer = [NSTimer scheduledTimerWithTimeInterval:_flushAfter + target:[self class] selector:@selector(flush) - userInfo:nil repeats:YES]; + userInfo:nil + repeats:YES]; }; if ( ! [[NSThread currentThread] isMainThread]) {