void run() { BackgroundJob* j = new IncTester( 0 /* inc without wait */ , true /* self delete */ ); j->go(); // the background thread should have continued running and this test should pass the // heap-checker as well mongo::sleepmillis( 1000 ); ASSERT_EQUALS( GLOBAL_val, 1 ); }
// static bool WiredTigerKVEngine::initRsOplogBackgroundThread(StringData ns) { if (!NamespaceString::oplog(ns)) { return false; } if (storageGlobalParams.repair) { LOG(1) << "not starting WiredTigerRecordStoreThread for " << ns << " because we are in repair"; return false; } boost::mutex::scoped_lock lock(_backgroundThreadMutex); NamespaceString nss(ns); if (_backgroundThreadNamespaces.count(nss)) { log() << "WiredTigerRecordStoreThread " << ns << " already started"; } else { log() << "Starting WiredTigerRecordStoreThread " << ns; BackgroundJob* backgroundThread = new WiredTigerRecordStoreThread(nss); backgroundThread->go(); _backgroundThreadNamespaces.insert(nss); } return true; }
// static bool TerarkDbKVEngine::initRsOplogBackgroundThread(StringData ns) { if (!NamespaceString::oplog(ns)) { return false; } if (storageGlobalParams.repair) { LOG(1) << "not starting TerarkDbRecordStoreThread for " << ns << " because we are in repair"; return false; } stdx::lock_guard<stdx::mutex> lock(_backgroundThreadMutex); NamespaceString nss(ns); if (_backgroundThreadNamespaces.count(nss)) { log() << "TerarkDbRecordStoreThread " << ns << " already started"; } else { log() << "Starting TerarkDbRecordStoreThread " << ns; BackgroundJob* backgroundThread = new TerarkDbRecordStoreThread(nss); backgroundThread->go(); _backgroundThreadNamespaces.insert(nss); } return true; }