Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void *digitizer()
- {
- char* dig_image;
- int tail = 0;
- while(1) {
- dig_image = read();
- pthread_mutex_lock(&buflock);
- if (bufavail == 0) {
- pthread_cond_wait(&buf_notempty, &buflock);
- }
- pthread_mutex_unlock(&buflock);
- frame_buf[tail%MAX] = dig_image;
- tail = tail + 1;
- pthread_mutex_lock(&buflock);
- bufavail = bufavail - 1;
- pthread_mutex_unlock(&buflock);
- if(bufavail < MAX) {
- pthread_cond_broadcast(&buf_notfull);
- }
- }
- }
- void *tracker()
- {
- char *pSource;
- char *pDestination;
- char* track_image;
- int head = 0;
- while(1) {
- pthread_mutex_lock(&buflock);
- if (bufavail == MAX)
- pthread_cond_wait(&buf_notfull, &buflock);
- pthread_mutex_unlock(&buflock);
- pSource = frame_buf[head%MAX];
- head = head + 1;
- pthread_mutex_lock(&buflock);
- bufavail = bufavail + 1;
- pthread_mutex_unlock(&buflock);
- if(bufavail > 0) {
- pthread_cond_broadcast(&buf_notempty);
- }
- pDestination = (char *)malloc(HEIGHT * WIDTH);
- rotate(pSource, pDestination, HEIGHT, WIDTH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement