/
ZMQContext.h
39 lines (31 loc) · 1.09 KB
/
ZMQContext.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
#import <Foundation/Foundation.h>
#import "ZMQSocket.h" // ZMQSocketType
#import <libkern/OSAtomic.h>
/* Special polling timeout values. */
#define ZMQPollTimeoutNever (-1)
#define ZMQPollTimeoutNow (0)
@interface ZMQContext : NSObject {
void *context;
NSMutableArray *sockets;
OSSpinLock socketsLock;
BOOL terminated;
}
+ (void)getZMQVersionMajor:(int *)major minor:(int *)minor patch:(int *)patch;
/* Polling */
// Generic poll interface.
+ (int)pollWithItems:(zmq_pollitem_t *)ioItems count:(int)itemCount
timeoutAfterUsec:(long)usec;
// Creates a ZMQContext using |threadCount| threads for I/O.
- (id)initWithIOThreads:(NSUInteger)threadCount;
- (ZMQSocket *)socketWithType:(ZMQSocketType)type;
// Sockets associated with this context.
@property(readonly, retain, NS_NONATOMIC_IPHONEONLY) NSArray *sockets;
// Closes all associated sockets.
- (void)closeSockets;
// Initiates termination. All associated sockets will be shut down.
- (void)terminate;
// YES if termination has been initiated.
// KVOable.
@property(readonly, getter=isTerminated, NS_NONATOMIC_IPHONEONLY)
BOOL terminated;
@end