You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request SDWebImage#3766 from dreampiggy/bugfix/uiview_webcache_sdcallbackqueue
Deprecate dispatch_main_async_safe, introduce two more policy `.safeAsyncMainThread` (for UIKit diffable data source) and `.safeAsyncMainQueue` (for most common cases)
/// Follow async/sync using the correspond `dispatch_async`/`dispatch_sync` to dispatch block on queue
17
17
SDCallbackPolicyDispatch = 1,
18
18
/// Ignore any async/sync and just directly invoke `block` in current queue (without `dispatch_async`/`dispatch_sync`)
19
-
SDCallbackPolicyInvoke = 2
19
+
SDCallbackPolicyInvoke = 2,
20
+
/// Ensure callback in main queue (no gurantee on main thread). Do `dispatch_async` if the current queue is not main queue; else do invoke `block`. Never use `dispatch_sync`, suitable for general UI-related code
21
+
SDCallbackPolicySafeAsyncMainQueue = 3,
22
+
/// Ensure callback in main thread. Do `dispatch_async` if the `NSThread.isMainTrhead == true` ; else do invoke `block`. Never use `dispatch_sync`, suitable for special UI-related code
23
+
SDCallbackPolicySafeAsyncMainThread = 4,
20
24
};
21
25
22
26
/// SDCallbackQueue is a wrapper used to control how the completionBlock should perform on queues, used by our `Cache`/`Manager`/`Loader`.
23
27
/// Useful when you call SDWebImage in non-main queue and want to avoid it callback into main queue, which may cause issue.
24
28
@interfaceSDCallbackQueue : NSObject
25
29
26
-
/// The shared main queue. This is the default value, has the same effect when passing `nil` to `SDWebImageContextCallbackQueue`
30
+
/// The main queue. This is the default value, has the same effect when passing `nil` to `SDWebImageContextCallbackQueue`
31
+
/// The policy defaults to `SDCallbackPolicySafeAsyncMainQueue`
0 commit comments