Skip to content

Commit 6fdfeeb

Browse files
committed
refactor: Replace RecursiveMutex with Mutex in rpc/server.cpp
1 parent d06cf34 commit 6fdfeeb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/rpc/server.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#include <mutex>
2121
#include <unordered_map>
2222

23-
static RecursiveMutex cs_rpcWarmup;
23+
static Mutex g_rpc_warmup_mutex;
2424
static std::atomic<bool> g_rpc_running{false};
25-
static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true;
26-
static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started";
25+
static bool fRPCInWarmup GUARDED_BY(g_rpc_warmup_mutex) = true;
26+
static std::string rpcWarmupStatus GUARDED_BY(g_rpc_warmup_mutex) = "RPC server started";
2727
/* Timer-creating functions */
2828
static RPCTimerInterface* timerInterface = nullptr;
2929
/* Map of name to timer. */
@@ -327,20 +327,20 @@ void RpcInterruptionPoint()
327327

328328
void SetRPCWarmupStatus(const std::string& newStatus)
329329
{
330-
LOCK(cs_rpcWarmup);
330+
LOCK(g_rpc_warmup_mutex);
331331
rpcWarmupStatus = newStatus;
332332
}
333333

334334
void SetRPCWarmupFinished()
335335
{
336-
LOCK(cs_rpcWarmup);
336+
LOCK(g_rpc_warmup_mutex);
337337
assert(fRPCInWarmup);
338338
fRPCInWarmup = false;
339339
}
340340

341341
bool RPCIsInWarmup(std::string *outStatus)
342342
{
343-
LOCK(cs_rpcWarmup);
343+
LOCK(g_rpc_warmup_mutex);
344344
if (outStatus)
345345
*outStatus = rpcWarmupStatus;
346346
return fRPCInWarmup;
@@ -439,7 +439,7 @@ UniValue CRPCTable::execute(const JSONRPCRequest &request) const
439439
{
440440
// Return immediately if in warmup
441441
{
442-
LOCK(cs_rpcWarmup);
442+
LOCK(g_rpc_warmup_mutex);
443443
if (fRPCInWarmup)
444444
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
445445
}

0 commit comments

Comments
 (0)