gpt4 book ai didi

objective-c - 是否可以在另一个线程上运行 sqlite3_exec()?

转载 作者:行者123 更新时间:2023-12-03 17:49:12 26 4
gpt4 key购买 nike

正如标题所述:是否可以运行该方法 sqlite3_exec()在另一个线程?

TBXMLSuccessBlock sBlock = ^(TBXML *tbxmlDocument) {
xmlArray = [NSMutableArray array];

if (tbxmlDocument.rootXMLElement)
[self fillArrayWithXmlContents:tbxmlDocument.rootXMLElement];

for (int i = 0; i < xmlArray.Count; i++)
sqlite3_exec(db, "Query that uses xmlArray values", 0, 0, 0);
};

如您所见,这是一个正在另一个线程上执行的块。

最佳答案

我推荐你到 sqlite3 FAQ :

Is SQLite threadsafe?

Threads are evil. Avoid them.

SQLite is threadsafe. We make this concession since many users choose to ignore the advice given in the previous paragraph. But in order to be thread-safe, SQLite must be compiled with the SQLITE_THREADSAFE preprocessor macro set to 1. Both the Windows and Linux precompiled binaries in the distribution are compiled this way. blah blah blah



所以我会说"is",应该没问题。

关于objective-c - 是否可以在另一个线程上运行 sqlite3_exec()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18588022/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com