-
-static void
-fd_source_closure_marshal (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- GFDSourceFunc callback;
- GCClosure *cc = (GCClosure*) closure;
- gboolean v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 0);
-
- callback = (GFDSourceFunc) (marshal_data ? marshal_data : cc->callback);
-
- v_return = callback (g_value_get_int (param_values),
- g_value_get_flags (param_values + 1),
- closure->data);
-
- g_value_set_boolean (return_value, v_return);
-}
-
-static GSourceFuncs fd_source_funcs = {
- fd_source_prepare,
- fd_source_check,
- fd_source_dispatch,
- fd_source_finalize,
- (GSourceFunc)fd_source_closure_callback,
- (GSourceDummyMarshal)fd_source_closure_marshal,
-};
-
-GSource *
-_g_fd_source_new (int fd,
- gushort events,
- GCancellable *cancellable)
-{
- GSource *source;
- FDSource *fd_source;
-
- source = g_source_new (&fd_source_funcs, sizeof (FDSource));
- fd_source = (FDSource *)source;
-
- fd_source->pollfd.fd = fd;
- fd_source->pollfd.events = events;
- g_source_add_poll (source, &fd_source->pollfd);
-
- if (cancellable)
- {
- GSource *cancellable_source = g_cancellable_source_new (cancellable);
-
- g_source_set_dummy_callback (cancellable_source);
- g_source_add_child_source (source, cancellable_source);
- g_source_unref (cancellable_source);
- }
-
- return source;
-}