Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dispatch_get_current_queue() iOS6 deprecation notices. #65

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions Lumberjack/DDAbstractDatabaseLogger.m
Expand Up @@ -239,7 +239,7 @@ - (void)createAndStartDeleteTimer

- (NSUInteger)saveThreshold
{
if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
{
return saveThreshold;
}
Expand Down Expand Up @@ -279,15 +279,15 @@ - (void)setSaveThreshold:(NSUInteger)threshold
}
};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
}

- (NSTimeInterval)saveInterval
{
if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
{
return saveInterval;
}
Expand Down Expand Up @@ -362,15 +362,15 @@ - (void)setSaveInterval:(NSTimeInterval)interval
}
};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
}

- (NSTimeInterval)maxAge
{
if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
{
return maxAge;
}
Expand Down Expand Up @@ -451,15 +451,15 @@ - (void)setMaxAge:(NSTimeInterval)interval
}
};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
}

- (NSTimeInterval)deleteInterval
{
if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
{
return deleteInterval;
}
Expand Down Expand Up @@ -533,15 +533,15 @@ - (void)setDeleteInterval:(NSTimeInterval)interval
}
};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
}

- (BOOL)deleteOnEverySave
{
if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
{
return deleteOnEverySave;
}
Expand All @@ -564,7 +564,7 @@ - (void)setDeleteOnEverySave:(BOOL)flag
deleteOnEverySave = flag;
};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
Expand All @@ -581,7 +581,7 @@ - (void)savePendingLogEntries
[self performSaveAndSuspendSaveTimer];
}};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
Expand All @@ -594,7 +594,7 @@ - (void)deleteOldLogEntries
[self performDelete];
}};

if (dispatch_get_current_queue() == loggerQueue)
if (dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) == loggerQueue)
block();
else
dispatch_async(loggerQueue, block);
Expand Down
10 changes: 5 additions & 5 deletions Lumberjack/DDFileLogger.m
Expand Up @@ -528,7 +528,7 @@ - (unsigned long long)maximumFileSize
// Note: The internal implementation should access the maximumFileSize variable directly,
// but if we forget to do this, then this method should at least work properly.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
return maximumFileSize;
Expand Down Expand Up @@ -562,7 +562,7 @@ - (void)setMaximumFileSize:(unsigned long long)newMaximumFileSize

}};

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand All @@ -586,7 +586,7 @@ - (NSTimeInterval)rollingFrequency
// Note: The internal implementation should access the rollingFrequency variable directly,
// but if we forget to do this, then this method should at least work properly.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
return rollingFrequency;
Expand Down Expand Up @@ -620,7 +620,7 @@ - (void)setRollingFrequency:(NSTimeInterval)newRollingFrequency

}};

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down Expand Up @@ -700,7 +700,7 @@ - (void)rollLogFile
[self rollLogFileNow];
}};

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down
6 changes: 3 additions & 3 deletions Lumberjack/DDLog.m
Expand Up @@ -868,7 +868,7 @@ - (id)initWithLogMsg:(NSString *)msg

machThreadID = pthread_mach_thread_np(pthread_self());

queueLabel = dd_str_copy(dispatch_queue_get_label(dispatch_get_current_queue()));
queueLabel = dd_str_copy(dispatch_queue_get_label(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)));

threadName = [[NSThread currentThread] name];
}
Expand Down Expand Up @@ -996,7 +996,7 @@ - (void)logMessage:(DDLogMessage *)logMessage
// So direct access to the formatter is only available if requested from the loggerQueue.
// In all other circumstances we need to go through the loggingQueue to get the proper value.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
return formatter;
Expand Down Expand Up @@ -1038,7 +1038,7 @@ - (void)setLogFormatter:(id <DDLogFormatter>)logFormatter
}
}};

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down
18 changes: 9 additions & 9 deletions Lumberjack/DDTTYLogger.m
Expand Up @@ -867,7 +867,7 @@ - (BOOL)colorsEnabled
// The design of this method is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
return colorsEnabled;
Expand Down Expand Up @@ -903,7 +903,7 @@ - (void)setColorsEnabled:(BOOL)newColorsEnabled
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down Expand Up @@ -956,7 +956,7 @@ - (void)setForegroundColor:(OSColor *)txtColor backgroundColor:(OSColor *)bgColo
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down Expand Up @@ -992,7 +992,7 @@ - (void)setForegroundColor:(OSColor *)txtColor backgroundColor:(OSColor *)bgColo
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down Expand Up @@ -1037,7 +1037,7 @@ - (void)clearColorsForFlag:(int)mask context:(int)context
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down Expand Up @@ -1065,7 +1065,7 @@ - (void)clearColorsForTag:(id <NSCopying>)tag
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand All @@ -1091,7 +1091,7 @@ - (void)clearColorsForAllFlags
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand All @@ -1117,7 +1117,7 @@ - (void)clearColorsForAllTags
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand All @@ -1144,7 +1144,7 @@ - (void)clearAllColors
// The design of the setter logic below is taken from the DDAbstractLogger implementation.
// For documentation please refer to the DDAbstractLogger implementation.

dispatch_queue_t currentQueue = dispatch_get_current_queue();
dispatch_queue_t currentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
if (currentQueue == loggerQueue)
{
block();
Expand Down