static int proc_kick_handler (zbar_processor_t *proc, int i) { processor_state_t *state = proc->state; //zprintf(5, "kicking %d fds\n", state->polling.num); unsigned junk[2]; //int rc = read(state->kick_fds[0], junk, 2 * sizeof(unsigned)); assert(proc->threaded); _zbar_mutex_lock(&proc->mutex); proc_cache_polling(proc->state); _zbar_mutex_unlock(&proc->mutex); //return(rc); return(-1); }
/* input handler thread to poll available inputs */ static void *proc_input_thread (void *arg) { zebra_processor_t *proc = arg; proc_block_sigs(); /* wait for registered inputs and process using associated handler */ while(1) { proc_cache_polling(proc); int rc = 0; while(!rc) { if(proc->polling.num) rc = proc_poll_inputs(proc, &proc->thr_polling, -1); else { struct timespec t; t.tv_sec = 4; t.tv_nsec = 0; rc = nanosleep(&t, NULL); } } } }