]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-fs: Added wait_ioloop/prev_ioloop helpers to struct fs.
authorTimo Sirainen <tss@iki.fi>
Mon, 15 Sep 2014 20:57:45 +0000 (23:57 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 15 Sep 2014 20:57:45 +0000 (23:57 +0300)
src/lib-fs/fs-api-private.h
src/lib-fs/fs-api.c

index 6e7cbd69889564384143e0b8866a36013ea0fa45..a5413ff3506abf2b7a707d949b8f3a516b16cb75 100644 (file)
@@ -64,6 +64,9 @@ struct fs {
        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;
 };
index 3192dbb08457eb0f42441314f6bae67c5295a07c..298c70955e2e7e32e33e437b3d257761d84ab19f 100644 (file)
@@ -529,14 +529,22 @@ int fs_wait_async(struct fs *fs)
 {
        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;