Use scoped locks instead of CRITICAL_BLOCK

This commit is contained in:
Pieter Wuille
2012-04-06 18:39:12 +02:00
parent 138d08c531
commit f8dcd5ca6f
19 changed files with 286 additions and 190 deletions

View File

@@ -1648,8 +1648,8 @@ Value walletlock(const Array& params, bool fHelp)
if (!pwalletMain->IsCrypted())
throw JSONRPCError(-15, "Error: running with an unencrypted wallet, but walletlock was called.");
CRITICAL_BLOCK(cs_nWalletUnlockTime)
{
LOCK(cs_nWalletUnlockTime);
pwalletMain->Lock();
nWalletUnlockTime = 0;
}
@@ -2498,9 +2498,10 @@ void ThreadRPCServer2(void* parg)
{
// Execute
Value result;
CRITICAL_BLOCK(cs_main)
CRITICAL_BLOCK(pwalletMain->cs_wallet)
{
LOCK2(cs_main, pwalletMain->cs_wallet);
result = (*(*mi).second)(params, false);
}
// Send reply
string strReply = JSONRPCReply(result, Value::null, id);