1. Cliff Biffle
  2. kinect-viewer

Source

kinect-viewer / KVDepthRecorder.m

Diff from to

File KVDepthRecorder.m

  • Ignore whitespace
 
 @interface KVDepthRecorder ()
 
+@property dispatch_queue_t dispatchQueue;
 @property NSFileHandle *fileHandle;
 
 @end
 
 @implementation KVDepthRecorder
 @synthesize fileHandle;
+@synthesize dispatchQueue;
+
+- init {
+  if (!(self = [super init])) return nil;
+  
+  dispatchQueue = dispatch_queue_create("org.mg8.kinect.depth-recorder", 0);
+
+  return self;
+}
+
+- (void)finalize {
+  dispatch_release(dispatchQueue);
+  [super finalize];
+}
 
 - (void) open: (NSString *) path {
   @synchronized (self) {
 }
 
 - (void) setLatestDepthSamples: (NSData *) data {
-  @synchronized (self) {
-    [fileHandle writeData: data];
-  }
+  NSData *copy = [NSData dataWithBytes: [data bytes] length: [data length]];
+  dispatch_async(dispatchQueue, ^{
+    [fileHandle writeData: copy];
+  });
 }
 
 - (NSData *) latestDepthSamples {