HrtThreadPool* hrt_thread_pool_new_func (GFunc handler_func, void *handler_data, GDestroyNotify handler_data_dnotify) { Handler *handler; handler = handler_new(handler_func, handler_data, handler_data_dnotify); return hrt_thread_pool_new(&handler_vtable, handler, handler_free); }
static GObject* hrt_task_runner_constructor(GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { GObject *object; HrtTaskRunner *runner; GError *error; object = G_OBJECT_CLASS(hrt_task_runner_parent_class)->constructor(type, n_construct_properties, construct_params); runner = HRT_TASK_RUNNER(object); g_assert(runner->event_loop != NULL); /* note that runner_context is NULL if it's the * global default context. */ runner->runner_context = g_main_context_get_thread_default(); error = NULL; runner->invoke_threads = hrt_thread_pool_new(&invoke_pool_vtable, runner, NULL); error = NULL; runner->event_thread = g_thread_create(task_runner_event_thread, runner, TRUE, &error); if (error != NULL) { g_error("create thread: %s", error->message); } /* wait for main loop to be running in event thread. This avoids * races, such as whether it's OK to quit the main loop in * dispose(). */ _hrt_event_loop_wait_running(runner->event_loop, TRUE); return object; }