Skip to content

Commit 22aac2c

Browse files
committed
fixed issue with global dispatch queue (so, each instance if EDQueue will get it's own :)
1 parent 12e0b86 commit 22aac2c

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

EDQueue/EDQueue.m

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
@interface EDQueue ()
2525

26-
@property (nonatomic, readwrite, nullable) NSString *activeJobTag;
26+
@property (nonatomic, nullable) NSString *activeJobTag;
27+
@property (nonatomic) dispatch_queue_t dispatchQueue;
2728

2829
@end
2930

@@ -49,6 +50,7 @@ - (instancetype)initWithPersistentStore:(id<EDQueuePersistentStorage>)persistent
4950
self = [super init];
5051
if (self) {
5152
_storage = persistentStore;
53+
self.dispatchQueue = dispatch_queue_create("edqueue.serial", DISPATCH_QUEUE_SERIAL);
5254
}
5355
return self;
5456
}
@@ -176,14 +178,7 @@ - (void)empty
176178
*/
177179
- (void)tick
178180
{
179-
static dispatch_once_t onceToken;
180-
static dispatch_queue_t gcd;
181-
182-
dispatch_once(&onceToken, ^{
183-
gcd = dispatch_queue_create("edqueue.serial", DISPATCH_QUEUE_SERIAL);
184-
});
185-
186-
dispatch_barrier_async(gcd, ^{
181+
dispatch_barrier_async(self.dispatchQueue, ^{
187182

188183
if (!self.isRunning) {
189184
return;

0 commit comments

Comments
 (0)