Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add quickie proof-of-concept test

  • Loading branch information...
commit a7dbbfe5a87ffbda995ab532c2d4800b2deaea48 1 parent 4918658
@mikeash authored
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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.