MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / WaitForDeleteWallet

Function WaitForDeleteWallet

src/wallet/wallet.cpp:262–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void WaitForDeleteWallet(std::shared_ptr<CWallet>&& wallet)
263{
264 // Mark wallet for unloading.
265 const std::string name = wallet->GetName();
266 {
267 LOCK(g_wallet_release_mutex);
268 g_unloading_wallet_set.insert(name);
269 // Do not expect to be the only one removing this wallet.
270 // Multiple threads could simultaneously be waiting for deletion.
271 }
272
273 // Time to ditch our shared_ptr and wait for FlushAndDeleteWallet call.
274 wallet.reset();
275 {
276 WAIT_LOCK(g_wallet_release_mutex, lock);
277 while (g_unloading_wallet_set.contains(name)) {
278 g_wallet_release_cv.wait(lock);
279 }
280 }
281}
282
283namespace {
284std::shared_ptr<CWallet> LoadWalletInternal(WalletContext& context, const std::string& name, std::optional<bool> load_on_start, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error, std::vector<bilingual_str>& warnings)

Callers 6

UnloadWalletsFunction · 0.85
BOOST_FIXTURE_TEST_CASEFunction · 0.85
TestUnloadWalletFunction · 0.85
unloadwalletFunction · 0.85
WalletCreateFunction · 0.85

Calls 5

GetNameMethod · 0.45
insertMethod · 0.45
resetMethod · 0.45
containsMethod · 0.45
waitMethod · 0.45

Tested by 2

BOOST_FIXTURE_TEST_CASEFunction · 0.68
TestUnloadWalletFunction · 0.68