#include #include #include //g++ main.cc -o myaudio -pthread //this thread calls a system call (with the arg as paramether) void *RecAndPlay(void *arg) { char *command; command = (char *)arg; system (command); return 0; } int main(){ pthread_t threadId; pthread_attr_t attr; int status = 0; system ("mkfifo temp.ub");//make a fifo file called temp.ub pthread_attr_init(&attr); status = pthread_create(&threadId,&attr, RecAndPlay, (void *)"rec -r 44100 --volume=1000 temp.ub"); if(status)printf("***ERROR***, pthread_create failed\n"); status = pthread_create(&threadId,&attr, RecAndPlay, (void *)"play -r 44100 --volume=1000 temp.ub"); if(status)printf("***ERROR***, pthread_create failed\n"); return 0; }