mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Add support for run loop queues with no handler, optimize
This commit is contained in:
@@ -16,8 +16,19 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ASRunLoopQueue<ObjectType> : NSObject
|
||||
|
||||
/**
|
||||
* Create a new queue with the given run loop and handler.
|
||||
*
|
||||
* @param runloop The run loop that will drive this queue.
|
||||
* @param handlerBlock An optional block to be run for each enqueued object.
|
||||
*
|
||||
* @discussion You may pass @c nil for the handler if you simply want the objects to
|
||||
* be retained at enqueue time, and released during the run loop step. This is useful
|
||||
* for creating a "main deallocation queue", as @c ASDeallocQueue creates its own
|
||||
* worker thread with its own run loop.
|
||||
*/
|
||||
- (instancetype)initWithRunLoop:(CFRunLoopRef)runloop
|
||||
andHandler:(void(^)(ObjectType dequeuedItem, BOOL isQueueDrained))handlerBlock;
|
||||
andHandler:(nullable void(^)(ObjectType dequeuedItem, BOOL isQueueDrained))handlerBlock;
|
||||
|
||||
- (void)enqueue:(ObjectType)object;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user