コード例 #1
0
ファイル: indexer.c プロジェクト: Distrotech/dovecot
int main(int argc, char *argv[])
{
	const char *error;

	master_service = master_service_init("indexer", 0, &argc, &argv, "");
	if (master_getopt(master_service) > 0)
		return FATAL_DEFAULT;

	if (master_service_settings_read_simple(master_service, NULL,
						&error) < 0)
		i_fatal("Error reading configuration: %s", error);
	set = master_service_settings_get(master_service);

	master_service_init_log(master_service, "indexer: ");
	restrict_access_by_env(NULL, FALSE);
	restrict_access_allow_coredumps(TRUE);
	master_service_set_idle_die_callback(master_service, idle_die);

	queue = indexer_queue_init(indexer_client_status_callback);
	indexer_queue_set_listen_callback(queue, queue_listen_callback);
	worker_pool = worker_pool_init("indexer-worker",
				       worker_status_callback);
	master_service_init_finish(master_service);

	master_service_run(master_service, client_connected);

	indexer_queue_cancel_all(queue);
	indexer_clients_destroy_all();
	worker_pool_deinit(&worker_pool);
	indexer_queue_deinit(&queue);

	master_service_deinit(&master_service);
        return 0;
}
コード例 #2
0
ファイル: array.c プロジェクト: NZOI/moe-cms
void
asort_start_threads(uns run)
{
  ucwlib_lock();
  asort_threads_use_count++;
  if (run && !asort_threads_ready)
    {
      // XXX: If somebody overrides the radix-sorter parameters to insane values,
      // he also should override the stack size to insane values.
      asort_thread_pool.stack_size = ucwlib_thread_stack_size + rs_estimate_stack();
      asort_thread_pool.num_threads = sorter_threads;
      ASORT_TRACE("Initializing thread pool (%d threads, %dK stack)", sorter_threads, asort_thread_pool.stack_size >> 10);
      worker_pool_init(&asort_thread_pool);
      asort_threads_ready = 1;
    }