Rename to use `dispatch_block_t` alias

This commit is contained in:
DreamPiggy 2023-01-06 19:09:39 +08:00
parent b5d712a378
commit 57403c9d3f
2 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@
*/
#import "SDWebImageDefine.h"
#import "SDWebImageCompat.h"
/// SDCallbackQueue is a wrapper used to control how the completionBlock should perform on queues, used by our `Cache`/`Manager`/`Loader`.
/// Useful when you call SDWebImage in non-main queue and want to avoid it callback into main queue, which may cause issue.
@ -28,20 +28,20 @@
/// Submits a block for execution and returns after that block finishes executing.
/// - Parameter block: The block that contains the work to perform.
- (void)sync:(nullable SDWebImageNoParamsBlock)block;
- (void)sync:(nullable dispatch_block_t)block;
/// Submits a block for execution and returns after that block finishes executing. When the current enqueued queue matching the callback queue, call the block immediately.
/// @warning This will not works when using `dispatch_set_target_queue` or recursive queue context.
/// - Parameter block: The block that contains the work to perform.
- (void)syncSafe:(nullable SDWebImageNoParamsBlock)block;
- (void)syncSafe:(nullable dispatch_block_t)block;
/// Schedules a block asynchronously for execution.
/// - Parameter block: The block that contains the work to perform.
- (void)async:(nullable SDWebImageNoParamsBlock)block;
- (void)async:(nullable dispatch_block_t)block;
/// Schedules a block asynchronously for execution. When the current enqueued queue matching the callback queue, call the block immediately.
/// @warning This will not works when using `dispatch_set_target_queue` or recursive queue context.
/// - Parameter block: The block that contains the work to perform.
- (void)asyncSafe:(nullable SDWebImageNoParamsBlock)block;
- (void)asyncSafe:(nullable dispatch_block_t)block;
@end

View File

@ -55,12 +55,12 @@ static void SDReleaseBlock(void *context) {
return queue;
}
- (void)sync:(SDWebImageNoParamsBlock)block {
- (void)sync:(dispatch_block_t)block {
if (!block) return;
dispatch_sync(self.queue, block);
}
- (void)syncSafe:(SDWebImageNoParamsBlock)block {
- (void)syncSafe:(dispatch_block_t)block {
if (!block) return;
// Special handle for main queue, faster
const char *currentLabel = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL);
@ -78,12 +78,12 @@ static void SDReleaseBlock(void *context) {
}
}
- (void)async:(SDWebImageNoParamsBlock)block {
- (void)async:(dispatch_block_t)block {
if (!block) return;
dispatch_async(self.queue, block);
}
- (void)asyncSafe:(SDWebImageNoParamsBlock)block {
- (void)asyncSafe:(dispatch_block_t)block {
if (!block) return;
// Special handle for main queue, faster
const char *currentLabel = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL);