Skip to content
Browse files

ZMQContext: Add -pollWithItems:count:timeoutAfterUsec:.

  • Loading branch information...
1 parent 8b06c84 commit be8d52816a038ad68ef57c76d5b63429509bfdf9 @jeremy-w committed Feb 6, 2011
Showing with 16 additions and 0 deletions.
  1. +9 −0 src/ZMQContext.h
  2. +7 −0 src/ZMQContext.m
View
9 src/ZMQContext.h
@@ -2,6 +2,10 @@
#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;
@@ -10,6 +14,11 @@
}
+ (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;
View
7 src/ZMQContext.m
@@ -15,6 +15,13 @@ + (void)getZMQVersionMajor:(int *)major minor:(int *)minor patch:(int *)patch {
(void)zmq_version(major, minor, patch);
}
+#pragma mark Polling
++ (int)pollWithItems:(zmq_pollitem_t *)ioItems count:(int)itemCount
+ timeoutAfterUsec:(long)usec {
+ int ret = zmq_poll(ioItems, itemCount, usec);
+ return ret;
+}
+
- (id)initWithIOThreads:(NSUInteger)threadCount {
self = [super init];
if (!self) return nil;

0 comments on commit be8d528

Please sign in to comment.
Something went wrong with that request. Please try again.