本文整理汇总了C++中DatabaseTaskSynchronizer::taskCompleted方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabaseTaskSynchronizer::taskCompleted方法的具体用法?C++ DatabaseTaskSynchronizer::taskCompleted怎么用?C++ DatabaseTaskSynchronizer::taskCompleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseTaskSynchronizer
的用法示例。
在下文中一共展示了DatabaseTaskSynchronizer::taskCompleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: databaseThread
void DatabaseThread::databaseThread()
{
{
// Wait for DatabaseThread::start() to complete.
LockHolder lock(m_threadCreationMutex);
LOG(StorageAPI, "Started DatabaseThread %p", this);
}
while (auto task = m_queue.waitForMessage()) {
AutodrainedPool pool;
task->performTask();
}
// Clean up the list of all pending transactions on this database thread
m_transactionCoordinator->shutdown();
LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThread %p, which currently has %i ref(s)", m_threadID, this, refCount());
// Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the database in an
// inconsistent or locked state.
DatabaseSet openSetCopy;
{
LockHolder lock(m_openDatabaseSetMutex);
if (m_openDatabaseSet.size() > 0) {
// As the call to close will modify the original set, we must take a copy to iterate over.
openSetCopy.swap(m_openDatabaseSet);
}
}
for (auto& openDatabase : openSetCopy)
openDatabase->close();
// Detach the thread so its resources are no longer of any concern to anyone else
detachThread(m_threadID);
DatabaseTaskSynchronizer* cleanupSync = m_cleanupSync;
// Clear the self refptr, possibly resulting in deletion
m_selfRef = nullptr;
if (cleanupSync) // Someone wanted to know when we were done cleaning up.
cleanupSync->taskCompleted();
}