1111
1212@interface STNetTaskQueue ()
1313
14- @property (nonatomic , strong ) NSThread *thred ;
14+ @property (nonatomic , strong ) NSThread *thread ;
1515@property (nonatomic , strong ) NSRecursiveLock *lock;
1616@property (nonatomic , strong ) NSMutableDictionary *taskDelegates; // <NSString, NSHashTable<STNetTaskDelegate>>
1717@property (nonatomic , strong ) NSMutableArray *tasks; // <STNetTask>
@@ -34,9 +34,9 @@ + (instancetype)sharedQueue
3434- (id )init
3535{
3636 if (self = [super init ]) {
37- self.thred = [[NSThread alloc ] initWithTarget: self selector: @selector (threadEntryPoint ) object: nil ];
38- self.thred .name = NSStringFromClass (self.class );
39- [self .thred start ];
37+ self.thread = [[NSThread alloc ] initWithTarget: self selector: @selector (threadEntryPoint ) object: nil ];
38+ self.thread .name = NSStringFromClass (self.class );
39+ [self .thread start ];
4040 self.lock = [NSRecursiveLock new ];
4141 self.lock .name = [NSString stringWithFormat: @" %@ Lock" , NSStringFromClass (self .class)];
4242 self.taskDelegates = [NSMutableDictionary new ];
@@ -76,7 +76,7 @@ - (void)addTask:(STNetTask *)task
7676 NSAssert (!task.finished && !task.cancelled, @" STNetTask is finished/cancelled, please recreate a net task." );
7777
7878 task.pending = YES ;
79- [self performInThread: self .thred usingBlock: ^{
79+ [self performInThread: self .thread usingBlock: ^{
8080 [self _addTask: task];
8181 }];
8282}
@@ -98,7 +98,7 @@ - (void)cancelTask:(STNetTask *)task
9898 return ;
9999 }
100100
101- [self performInThread: self .thred usingBlock: ^{
101+ [self performInThread: self .thread usingBlock: ^{
102102 [self _cancelTask: task];
103103 }];
104104}
@@ -143,7 +143,7 @@ - (void)_sendWatingTasks
143143
144144- (void )task : (STNetTask *)task didResponse : (id )response
145145{
146- [self performInThread: self .thred usingBlock: ^{
146+ [self performInThread: self .thread usingBlock: ^{
147147 [self _task: task didResponse: response];
148148 }];
149149}
@@ -182,7 +182,7 @@ - (void)_task:(STNetTask *)task didResponse:(id)response
182182
183183- (void )task : (STNetTask *)task didFailWithError : (NSError *)error
184184{
185- [self performInThread: self .thred usingBlock: ^{
185+ [self performInThread: self .thread usingBlock: ^{
186186 [self _task: task didFailWithError: error];
187187 }];
188188}
0 commit comments