invisible
annotate src/frame.cc @ 1:fdbd55eaa14e
add frame class, mutices
author | Eleni Maria Stea <eleni@mutantstargoat.com> |
---|---|
date | Sat, 05 Oct 2013 19:02:40 +0300 |
parents | |
children | b0b90ef993a0 |
rev | line source |
---|---|
eleni@1 | 1 #include <stdio.h> |
eleni@1 | 2 #include <pthread.h> |
eleni@1 | 3 |
eleni@1 | 4 #include "frame.h" |
eleni@1 | 5 |
eleni@1 | 6 static pthread_mutex_t video_mutex = PTHREAD_MUTEX_INITIALIZER; |
eleni@1 | 7 static pthread_mutex_t depth_mutex = PTHREAD_MUTEX_INITIALIZER; |
eleni@1 | 8 |
eleni@1 | 9 void init_frame_mx() |
eleni@1 | 10 { |
eleni@1 | 11 pthread_mutex_init(&video_mutex, NULL); |
eleni@1 | 12 pthread_mutex_init(&depth_mutex, NULL); |
eleni@1 | 13 } |
eleni@1 | 14 |
eleni@1 | 15 void video_cb(freenect_device *kin_dev, void *rgb, uint32_t time) |
eleni@1 | 16 { |
eleni@1 | 17 pthread_mutex_lock(&video_mutex); |
eleni@1 | 18 printf("Started video.\n"); |
eleni@1 | 19 pthread_mutex_unlock(&video_mutex); |
eleni@1 | 20 } |
eleni@1 | 21 |
eleni@1 | 22 void depth_cb(freenect_device *kin_dev, void *depth, uint32_t time) |
eleni@1 | 23 { |
eleni@1 | 24 pthread_mutex_lock(&depth_mutex); |
eleni@1 | 25 printf("Started depth.\n"); |
eleni@1 | 26 pthread_mutex_unlock(&depth_mutex); |
eleni@1 | 27 } |