Пример #1
0
static void iv_getaddrinfo_tls_init_thread(void *_tinfo)
{
	struct iv_getaddrinfo_thr_info *tinfo = _tinfo;

	tinfo->num_requests = 0;

	IV_WORK_POOL_INIT(&tinfo->pool);
	tinfo->pool.max_threads = 100;
	tinfo->pool.cookie = NULL;
	tinfo->pool.thread_start = NULL;
	tinfo->pool.thread_stop = NULL;
}
Пример #2
0
int main()
{
	iv_init();

	iv_thread_set_debug_state(1);

	IV_WORK_POOL_INIT(&pool);
	pool.max_threads = 8;
	iv_work_pool_create(&pool);

	IV_WORK_ITEM_INIT(&item_a);
	item_a.cookie = "a";
	item_a.work = work;
	item_a.completion = work_complete;
	iv_work_pool_submit_work(&pool, &item_a);

	IV_WORK_ITEM_INIT(&item_b);
	item_b.cookie = "b";
	item_b.work = work;
	item_b.completion = work_complete;
	iv_work_pool_submit_work(&pool, &item_b);

	IV_WORK_ITEM_INIT(&item_c);
	item_c.cookie = "c";
	item_c.work = work;
	item_c.completion = work_complete;
	iv_work_pool_submit_work(&pool, &item_c);

	IV_WORK_ITEM_INIT(&item_d);
	item_d.cookie = "d";
	item_d.work = work;
	item_d.completion = work_complete;
	iv_work_pool_submit_work(&pool, &item_d);

	item_count = 4;

	iv_main();

	iv_deinit();

	return 0;
}