# HG changeset patch # User Timo Sirainen # Date 1314221261 -10800 # Node ID b6b16c9eb3d57cf0c66832a401eb7eeb3c8c6e55 # Parent c17e4f8ddc81bbe0814e5de702130b8c214cf3cb liblib: Added io_loop_get_current_context() diff -r c17e4f8ddc81 -r b6b16c9eb3d5 src/lib/ioloop.c --- 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; diff -r c17e4f8ddc81 -r b6b16c9eb3d5 src/lib/ioloop.h --- 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. */