dovecot-2.2: lib-fs: Added wait_ioloop/prev_ioloop helpers to st...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 15 21:01:49 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/784883cc0be6
changeset: 17802:784883cc0be6
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 15 23:57:45 2014 +0300
description:
lib-fs: Added wait_ioloop/prev_ioloop helpers to struct fs.

diffstat:

 src/lib-fs/fs-api-private.h |  3 +++
 src/lib-fs/fs-api.c         |  8 ++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r 3675d156b309 -r 784883cc0be6 src/lib-fs/fs-api-private.h
--- a/src/lib-fs/fs-api-private.h	Mon Sep 15 18:04:20 2014 +0300
+++ b/src/lib-fs/fs-api-private.h	Mon Sep 15 23:57:45 2014 +0300
@@ -64,6 +64,9 @@
 	struct fs_settings set;
 	string_t *last_error;
 
+	/* may be used by fs_wait_async() to do the waiting */
+	struct ioloop *wait_ioloop, *prev_ioloop;
+
 	unsigned int files_open_count;
 	struct fs_file *files;
 };
diff -r 3675d156b309 -r 784883cc0be6 src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Mon Sep 15 18:04:20 2014 +0300
+++ b/src/lib-fs/fs-api.c	Mon Sep 15 23:57:45 2014 +0300
@@ -529,14 +529,22 @@
 {
 	int ret;
 
+	/* recursion not allowed */
+	i_assert(fs->prev_ioloop == NULL);
+
 	if (fs->v.wait_async == NULL)
 		ret = 0;
 	else T_BEGIN {
+		fs->prev_ioloop = current_ioloop;
 		ret = fs->v.wait_async(fs);
+		i_assert(current_ioloop == fs->prev_ioloop);
+		fs->prev_ioloop = NULL;
 	} T_END;
 	return ret;
 }
 
+
+
 int fs_lock(struct fs_file *file, unsigned int secs, struct fs_lock **lock_r)
 {
 	int ret;


More information about the dovecot-cvs mailing list