#include "postProcessing.h" #include static void* startProcessData(void *n){ postProcessing *myDet=(postProcessing*)n; myDet->processData(); pthread_exit(NULL); }; int postProcessing::kbhit(){ struct timeval tv; fd_set fds; tv.tv_sec = 0; tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); //STDIN_FILENO is 0 select(STDIN_FILENO+1, &fds, NULL, NULL, &tv); return FD_ISSET(STDIN_FILENO, &fds); } postProcessing::postProcessing(): threadedProcessing(0), jointhread(0), acquiringDone(0), fdata(0), thisData(0), dataReady(0), pCallbackArg(0) { pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER; mp=mp1; pthread_mutex_init(&mp, NULL); mg=mp1; pthread_mutex_init(&mg, NULL); ms=mp1; pthread_mutex_init(&ms, NULL); } postProcessing::~postProcessing(){ } void* postProcessing::processData() { if(setReceiverOnline()==OFFLINE_FLAG){ return 0; } //receiver else{ //cprintf(RED,"In post processing threads\n"); if(dataReady) { readFrameFromReceiver(); } //only update progress else{ int caught = -1; char c; int ifp; while(true){ // set only in startThread if (*threadedProcessing==0) setTotalProgress(); // to exit acquire by typing q ifp=kbhit(); if (ifp!=0){ c=fgetc(stdin); if (c=='q') { std::cout<<"Caught the command to stop acquisition"<