예제 #1
0
파일: io_thread.c 프로젝트: andrewrk/mpd
static gpointer
io_thread_func(G_GNUC_UNUSED gpointer arg)
{
	/* lock+unlock to synchronize with io_thread_start(), to be
	   sure that io.thread is set */
	g_mutex_lock(io.mutex);
	g_mutex_unlock(io.mutex);

	io_thread_run();
	return NULL;
}
int
main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
{
	g_thread_init(NULL);
	signals_init();
	io_thread_init();

	struct ntp_server ntp;
	ntp_server_init(&ntp);

	GError *error = NULL;
	if (!ntp_server_open(&ntp, &error)) {
		io_thread_deinit();
		g_printerr("%s\n", error->message);
		g_error_free(error);
		return EXIT_FAILURE;
	}

	io_thread_run();

	ntp_server_close(&ntp);
	io_thread_deinit();
	return EXIT_SUCCESS;
}