Permalink
Browse files

add quickie proof-of-concept test

  • Loading branch information...
1 parent 4918658 commit a7dbbfe5a87ffbda995ab532c2d4800b2deaea48 @mikeash committed Dec 2, 2010
Showing with 18 additions and 1 deletion.
  1. +18 −1 main.m
View
19 main.m
@@ -1,9 +1,26 @@
#import <Foundation/Foundation.h>
+#import "MAAsyncReader.h"
+
+
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- NSLog(@"Hello, World!");
+
+ int fd = open("/dev/null", O_RDONLY);
+ MAAsyncReader *reader = [[MAAsyncReader alloc] initWithFileDescriptor: fd];
+ [reader setErrorHandler: ^(int err) {
+ NSLog(@"got error %d (%s)", err, strerror(err));
+ }];
+
+ [reader readUntilCondition: ^NSUInteger (NSData *buffer) { return 0; }
+ callback: ^(NSData *data) {
+ NSLog(@"got data %@", data);
+ if(!data)
+ exit(0);
+ }];
+
+ dispatch_main();
[pool drain];
return 0;
}

0 comments on commit a7dbbfe

Please sign in to comment.