Refactor the run loop implementation code into a proper queue abstraction.

ASRunLoopQueue can process a specified number of items per run loop iteration
via a block based api.
This commit is contained in:
Rahul Malik
2016-03-07 23:06:18 -08:00
parent 9e72679ffd
commit f388180a1d
4 changed files with 153 additions and 67 deletions

View File

@@ -0,0 +1,23 @@
//
// ASRunLoopQueue.h
// AsyncDisplayKit
//
// Created by Rahul Malik on 3/7/16.
// Copyright © 2016 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface ASRunLoopQueue<ObjectType> : NSObject
- (instancetype)initWithRunLoop:(CFRunLoopRef)runloop andHandler:(void(^)(ObjectType dequeuedItem, BOOL isQueueDrained))handlerBlock;
- (void)enqueue:(ObjectType)object;
@property (nonatomic, assign) NSUInteger batchSize;
@end
NS_ASSUME_NONNULL_END