mirror of
https://github.com/Harshit-Dhanwalkar/AsciiCam.git
synced 2026-06-24 11:08:06 +02:00
Add thread sharing for producer(webcam) and consumer(rendering) threads
This commit is contained in:
parent
319746afe6
commit
c1f0298dae
5 changed files with 122 additions and 3 deletions
17
C/include/thread_sharing.h
Normal file
17
C/include/thread_sharing.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include "ascii.h"
|
||||
|
||||
typedef struct {
|
||||
uint8_t *buf[2]; // Duble buffer
|
||||
int width, height;
|
||||
int ascii_w, ascii_h;
|
||||
int ready_idx;
|
||||
int has_frame;
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cond;
|
||||
volatile int stop;
|
||||
|
||||
ascii_opts_t opts;
|
||||
} shared_frame_t;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue