Skip to content

Commit d2a3e2e

Browse files
committed
Make "pending", "cancelled", "finished" and "retryCount" in STNetTask public readonly and internal readwrite.
1 parent 06e20e5 commit d2a3e2e

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

STNetTaskQueue/STNetTask.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ FOUNDATION_EXPORT NSString *const STNetTaskUnknownError;
4848
Indicates if the net task is waiting for executing or executing.
4949
This value will be set to "YES" immediately after the net task is added to net task queue.
5050
*/
51-
@property (atomic, assign) BOOL pending;
51+
@property (atomic, assign, readonly) BOOL pending;
5252

5353
/*
5454
Indicates if the net task is cancelled.
5555
This value would be "NO" by default after net task is created, even the net task is not added to queue.
5656
*/
57-
@property (atomic, assign) BOOL cancelled;
57+
@property (atomic, assign, readonly) BOOL cancelled;
5858

5959
/* Indicates if the net task is finished(no matter it's successful or failed). */
60-
@property (atomic, assign) BOOL finished;
60+
@property (atomic, assign, readonly) BOOL finished;
6161

6262
/* The current retry time @see maxRetryCount */
63-
@property (atomic, assign) NSUInteger retryCount;
63+
@property (atomic, assign, readonly) NSUInteger retryCount;
6464

6565
/*
6666
A unique string represents the net task.

STNetTaskQueue/STNetTask.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010

1111
NSString *const STNetTaskUnknownError = @"STNetTaskUnknownError";
1212

13+
@interface STNetTask ()
14+
15+
@property (atomic, assign) BOOL pending;
16+
@property (atomic, assign) BOOL cancelled;
17+
@property (atomic, assign) BOOL finished;
18+
@property (atomic, assign) NSUInteger retryCount;
19+
20+
@end
21+
1322
@implementation STNetTask
1423

1524
- (NSString *)uri

STNetTaskQueue/STNetTaskQueue.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99
#import "STNetTaskQueue.h"
1010
#import "STNetTaskQueueLog.h"
1111

12+
@interface STNetTask (STInternal)
13+
14+
@property (atomic, assign) BOOL pending;
15+
@property (atomic, assign) BOOL cancelled;
16+
@property (atomic, assign) BOOL finished;
17+
@property (atomic, assign) NSUInteger retryCount;
18+
19+
@end
20+
1221
@interface STNetTaskQueue()
1322

1423
@property (nonatomic, strong) NSThread *thread;

0 commit comments

Comments
 (0)