void constructor() { eq_init(1, 1, dlsym(RTLD_NEXT, "malloc"), dlsym(RTLD_NEXT, "free"), dlsym(RTLD_NEXT, "sched_yield"), dlsym(RTLD_NEXT, "usleep")); }
void WorkerThreads::setup_event_thread(LIBEVENT_THREAD *me) { me->base=event_init();//every thread has its own event_base if(!me->base) { fprintf(stderr,"can't allocate event base\n"); exit(1); } event_set(&me->notify_event,me->notify_receive_fd, //设置 监听事件 和 处理函数 EV_READ|EV_PERSIST, thread_libevent_process,me); event_base_set(me->base,&me->notify_event); if(event_add(&me->notify_event,0)==-1) { fprintf(stderr,"can't monitor libevent notify pipe\n"); exit(1); } //why initiate conn_queue here? me->new_conn_queue=(event_queue*)malloc(sizeof(struct event_queue)); //内部的conn_queue if(me->new_conn_queue==NULL) { perror("Failed to allocate memory for connection queue"); exit(EXIT_FAILURE); } eq_init(me->new_conn_queue); }
int main(void) { // Enable peripherals system_init(); pins_init(); us1_init(); us0_init(); twi_init(); // Initialize state machines qcfp_init(); eq_init(); // Once everything is initialized, enable interrupts globally interrupts_enable(); // Enable Expansion module 3 and 4 (sensors plugged into these temporarily) AT91C_BASE_PIOA->PIO_CODR = AT91C_PIO_PA20; AT91C_BASE_PIOA->PIO_CODR = AT91C_PIO_PA23; sensors_init(); eq_post_timer(gpio_led_dance, 250, eq_timer_periodic); while(1) { eq_dispatch(); eq_dispatch_timers(); } return 0; }
void effect_init() { echo_init(&effect.echo); stereo_init(&effect.stereo); voice_init(&effect.voice); normal_init(&effect.normal); eq_init(&effect.eq); }