Browse Source

Lock vnThreadsRunning[THREAD_RPCHANDLER].

0.8
Matt Corallo 13 years ago
parent
commit
4e97a9d9eb
  1. 17
      src/bitcoinrpc.cpp

17
src/bitcoinrpc.cpp

@ -2913,10 +2913,15 @@ void ThreadRPCServer2(void* parg)
StopRequests(); StopRequests();
} }
static CCriticalSection cs_THREAD_RPCHANDLER;
void ThreadRPCServer3(void* parg) void ThreadRPCServer3(void* parg)
{ {
IMPLEMENT_RANDOMIZE_STACK(ThreadRPCServer3(parg)); IMPLEMENT_RANDOMIZE_STACK(ThreadRPCServer3(parg));
vnThreadsRunning[THREAD_RPCHANDLER]++; {
LOCK(cs_THREAD_RPCHANDLER);
vnThreadsRunning[THREAD_RPCHANDLER]++;
}
AcceptedConnection *conn = (AcceptedConnection *) parg; AcceptedConnection *conn = (AcceptedConnection *) parg;
bool fRun = true; bool fRun = true;
@ -2925,7 +2930,10 @@ void ThreadRPCServer3(void* parg)
{ {
conn->close(); conn->close();
delete conn; delete conn;
--vnThreadsRunning[THREAD_RPCHANDLER]; {
LOCK(cs_THREAD_RPCHANDLER);
--vnThreadsRunning[THREAD_RPCHANDLER];
}
return; return;
} }
map<string, string> mapHeaders; map<string, string> mapHeaders;
@ -3005,7 +3013,10 @@ void ThreadRPCServer3(void* parg)
} }
delete conn; delete conn;
vnThreadsRunning[THREAD_RPCHANDLER]--; {
LOCK(cs_THREAD_RPCHANDLER);
vnThreadsRunning[THREAD_RPCHANDLER]--;
}
} }
json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_spirit::Array &params) const json_spirit::Value CRPCTable::execute(const std::string &strMethod, const json_spirit::Array &params) const

Loading…
Cancel
Save