int main() { queue = array_queue_create(QUEUE_SIZE); test_producer_consumer(); DEBUG_DBG("exit\n"); array_queue_destroy(queue); }
static void test_producer(int nr) { int inc; pthread_t id; for (inc = 0; inc < nr; inc++) { pthread_create(&producer_id[inc], NULL, producer_thread, NULL); DEBUG_DBG("Create producer thread %d\n", inc); } }
static void switch_key_work_func(struct work_struct *work) { if(switch_key_obj.switch_key_input == NULL) { DEBUG_ERR("switch_key/gpio_keys input pdev null\n"); return; } if(gpio_get_value(switch_key_obj.pdata->irq_gpio)){ DEBUG_DBG("%s : irq gpio level high\n", __func__); input_report_key(switch_key_obj.switch_key_input, KEY_MUTE,KEY_PRESS); input_sync(switch_key_obj.switch_key_input); msleep(100); input_report_key(switch_key_obj.switch_key_input, KEY_MUTE,KEY_RELEASE); input_sync(switch_key_obj.switch_key_input); }else{ DEBUG_DBG("%s : irq gpio level low\n", __func__); input_report_key(switch_key_obj.switch_key_input, KEY_VOLUMEUP,KEY_PRESS); input_sync(switch_key_obj.switch_key_input); msleep(100); input_report_key(switch_key_obj.switch_key_input, KEY_VOLUMEUP,KEY_RELEASE); input_sync(switch_key_obj.switch_key_input); } }