diff options
author | Dan Winship <danw@src.gnome.org> | 2005-11-10 16:48:42 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2005-11-10 16:48:42 +0000 |
commit | 9781c6572877b6a2b83661073cf7932e4d54566b (patch) | |
tree | d43354b1a7692460514c516c3449c034cb642110 /libsoup/soup-misc.c | |
parent | fda55879a793982bf069d399fce60c85380ad7b0 (diff) | |
download | libsoup-9781c6572877b6a2b83661073cf7932e4d54566b.tar.gz |
bump version to 2.2.90. This will not be officially released, but once
* configure.in: bump version to 2.2.90. This will not be
officially released, but once these patches have gotten some
testing they may be pulled up to the gnome-2-12 branch.
* libsoup/soup-connection.c:
* libsoup/soup-server.c:
* libsoup/soup-session.c:
* libsoup/soup-socket.c: add an "async-context" property,
which gets passed from server to socket, and session to connection
to socket, allowing async usage outside the main thread. Based on
patches from Armin Bauer and Jürg Billeter.
* libsoup/soup-misc.c (soup_add_io_watch, soup_add_idle,
soup_add_timeout): utility routines to add watches, idles, and
timeouts to non-default GMainContexts.
* libsoup/soup-message-io.c (io_write): set the read state
appropriately after writing a "100 Continue" response
(io_read): More 100-Continue stuff. I don't think this is quite
right so it will probably change again later.
Diffstat (limited to 'libsoup/soup-misc.c')
-rw-r--r-- | libsoup/soup-misc.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c index 500caadd..7f19d5dd 100644 --- a/libsoup/soup-misc.c +++ b/libsoup/soup-misc.c @@ -392,3 +392,81 @@ soup_signal_connect_once (gpointer instance, const char *detailed_signal, closure, FALSE); return ssod->signal_id; } + +/** + * soup_add_io_watch: + * @async_context: the #GMainContext to dispatch the I/O watch in, or + * %NULL for the default context + * @chan: the #GIOChannel to watch + * @condition: the condition to watch for + * @function: the callback to invoke when @condition occurs + * @data: user data to pass to @function + * + * Adds an I/O watch as with g_io_add_watch(), but using the given + * @async_context. + * + * Return value: a #GSource, which can be removed from @async_context + * with g_source_destroy(). + **/ +GSource * +soup_add_io_watch (GMainContext *async_context, + GIOChannel *chan, GIOCondition condition, + GIOFunc function, gpointer data) +{ + GSource *watch = g_io_create_watch (chan, condition); + g_source_set_callback (watch, (GSourceFunc) function, data, NULL); + g_source_attach (watch, async_context); + g_source_unref (watch); + return watch; +} + +/** + * soup_add_idle: + * @async_context: the #GMainContext to dispatch the idle event in, or + * %NULL for the default context + * @function: the callback to invoke at idle time + * @data: user data to pass to @function + * + * Adds an idle event as with g_idle_add(), but using the given + * @async_context. + * + * Return value: a #GSource, which can be removed from @async_context + * with g_source_destroy(). + **/ +GSource * +soup_add_idle (GMainContext *async_context, + GSourceFunc function, gpointer data) +{ + GSource *source = g_idle_source_new (); + g_source_set_callback (source, function, data, NULL); + g_source_attach (source, async_context); + g_source_unref (watch); + return source; +} + +/** + * soup_add_timeout: + * @async_context: the #GMainContext to dispatch the timeout in, or + * %NULL for the default context + * @interval: the timeout interval, in milliseconds + * @function: the callback to invoke at timeout time + * @data: user data to pass to @function + * + * Adds a timeout as with g_timeout_add(), but using the given + * @async_context. + * + * Return value: a #GSource, which can be removed from @async_context + * with g_source_destroy(). + **/ +GSource * +soup_add_timeout (GMainContext *async_context, + guint interval, + GSourceFunc function, gpointer data) +{ + GSource *source = g_timeout_source_new (interval); + g_source_set_callback (source, function, data, NULL); + g_source_attach (source, async_context); + g_source_unref (watch); + return source; +} + |