Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于FMDBQueue的问题 #50

Open
Akateason opened this issue May 3, 2017 · 2 comments
Open

关于FMDBQueue的问题 #50

Akateason opened this issue May 3, 2017 · 2 comments

Comments

@Akateason
Copy link

我读代码的时候有个问题. 这个写法似乎不合理

    NSMutableArray *users = [NSMutableArray array];
    [jkDB.dbQueue inDatabase:^(FMDatabase *db) {

            //. . .
            [users addObject:model];
            FMDBRelease(model);
        }
    }];
    
    return users;

比如像上面这种情况,我在queue里有很多个操作, 你如何能够确定.你在block外面写返回值. 而此时的返回能保证block里的获取的list已经执行完了? 这个return是立即返回的.

@Akateason
Copy link
Author

oh. my fault. 阅读fmdb文档之后.我理解了这个问题! 这个queue并非是异步返回.而是专门用来共享一个DB.

@liubang0909
Copy link

FMDBRelease(model); 这句话是什么意思? 会不会造成过度释放?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants