changeset 13286:b6b16c9eb3d5

liblib: Added io_loop_get_current_context()
author Timo Sirainen <tss@iki.fi>
date Thu, 25 Aug 2011 00:27:41 +0300
parents c17e4f8ddc81
children 957060ca5b69
files src/lib/ioloop.c src/lib/ioloop.h
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop.c	Thu Aug 25 00:27:10 2011 +0300
+++ b/src/lib/ioloop.c	Thu Aug 25 00:27:41 2011 +0300
@@ -600,6 +600,11 @@
 	io_loop_context_unref(&ctx);
 }
 
+struct ioloop_context *io_loop_get_current_context(struct ioloop *ioloop)
+{
+	return ioloop->cur_ctx;
+}
+
 struct io *io_loop_move_io(struct io **_io)
 {
 	struct io *new_io, *old_io = *_io;
--- a/src/lib/ioloop.h	Thu Aug 25 00:27:10 2011 +0300
+++ b/src/lib/ioloop.h	Thu Aug 25 00:27:41 2011 +0300
@@ -116,6 +116,8 @@
 void io_loop_context_remove_callbacks(struct ioloop_context *ctx,
 				      io_callback_t *activate,
 				      io_callback_t *deactivate, void *context);
+/* Returns the current context set to ioloop. */
+struct ioloop_context *io_loop_get_current_context(struct ioloop *ioloop);
 
 /* Move the given I/O into the current I/O loop if it's not already
    there. New I/O is returned, while the old one is freed. */