-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDispatch+Convenience.h
41 lines (26 loc) · 1.05 KB
/
Dispatch+Convenience.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// Dispatch+Convenience.h
// Sleep Diary
//
// Created by Alexander Ivanov on 16.10.16.
// Copyright © 2016 Alexander Ivanov. All rights reserved.
//
#import <Foundation/Foundation.h>
#define GCD_MAIN dispatch_get_main_queue()
#define GCD_GLOBAL dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)
#define GCD_CONCURRENT(label) dispatch_queue_create(label, DISPATCH_QUEUE_CONCURRENT)
#define GCD_SERIAL(label) dispatch_queue_create(label, DISPATCH_QUEUE_SERIAL)
@interface GCD : NSObject
- (instancetype)initWithCount:(NSInteger)count;
- (BOOL)signal;
- (BOOL)wait:(NSTimeInterval)time;
- (BOOL)wait;
+ (void)sync:(void (^)(GCD *sema))sync wait:(NSTimeInterval)time;
+ (void)sync:(void (^)(GCD *sema))sync;
+ (void)queue:(dispatch_queue_t)queue after:(NSTimeInterval)after block:(void (^)(void))block;
+ (void)global:(void (^)(void))block;
+ (void)main:(void (^)(void))block;
+ (void)once:(void (^)(void))block;
+ (BOOL)wait:(NSTimeInterval)interval flag:(BOOL *)flag step:(NSTimeInterval)step;
+ (BOOL)wait:(NSTimeInterval)interval flag:(BOOL *)flag;
@end