mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
Give threads a recognisable name to aid in debugging
NOTE: These thread names are visible in gdb when using 'info threads'.
Additionally both 'top' and 'ps' show these names *unless* told to
display the command-line instead of task name.
Signed-off-by: Giel van Schijndel <me@mortis.eu>
This commit is contained in:
34
src/net.cpp
34
src/net.cpp
@@ -407,6 +407,9 @@ bool GetMyExternalIP(CNetAddr& ipRet)
|
||||
|
||||
void ThreadGetMyExternalIP(void* parg)
|
||||
{
|
||||
// Make this thread recognisable as the message handling thread
|
||||
RenameThread("bitcoin-ext-ip");
|
||||
|
||||
CNetAddr addrLocalHost;
|
||||
if (GetMyExternalIP(addrLocalHost))
|
||||
{
|
||||
@@ -636,6 +639,10 @@ void CNode::copyStats(CNodeStats &stats)
|
||||
void ThreadSocketHandler(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadSocketHandler(parg));
|
||||
|
||||
// Make this thread recognisable as the networking thread
|
||||
RenameThread("bitcoind [net]");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_SOCKETHANDLER]++;
|
||||
@@ -988,6 +995,10 @@ void ThreadSocketHandler2(void* parg)
|
||||
void ThreadMapPort(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadMapPort(parg));
|
||||
|
||||
// Make this thread recognisable as the UPnP thread
|
||||
RenameThread("bitcoind [UPnP]");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_UPNP]++;
|
||||
@@ -1146,6 +1157,10 @@ static const char *strDNSSeed[][2] = {
|
||||
void ThreadDNSAddressSeed(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadDNSAddressSeed(parg));
|
||||
|
||||
// Make this thread recognisable as the DNS seeding thread
|
||||
RenameThread("bitcoin-dnsseed");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_DNSSEED]++;
|
||||
@@ -1315,6 +1330,10 @@ void ThreadDumpAddress2(void* parg)
|
||||
void ThreadDumpAddress(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadDumpAddress(parg));
|
||||
|
||||
// Make this thread recognisable as the address dumping thread
|
||||
RenameThread("bitcoin-adrdump");
|
||||
|
||||
try
|
||||
{
|
||||
ThreadDumpAddress2(parg);
|
||||
@@ -1328,6 +1347,10 @@ void ThreadDumpAddress(void* parg)
|
||||
void ThreadOpenConnections(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadOpenConnections(parg));
|
||||
|
||||
// Make this thread recognisable as the connection opening thread
|
||||
RenameThread("bitcoin-opencon");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_OPENCONNECTIONS]++;
|
||||
@@ -1481,6 +1504,10 @@ void ThreadOpenConnections2(void* parg)
|
||||
void ThreadOpenAddedConnections(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadOpenAddedConnections(parg));
|
||||
|
||||
// Make this thread recognisable as the connection opening thread
|
||||
RenameThread("bitcoin-opencon");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++;
|
||||
@@ -1610,6 +1637,10 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu
|
||||
void ThreadMessageHandler(void* parg)
|
||||
{
|
||||
IMPLEMENT_RANDOMIZE_STACK(ThreadMessageHandler(parg));
|
||||
|
||||
// Make this thread recognisable as the message handling thread
|
||||
RenameThread("bitcoin-msghand");
|
||||
|
||||
try
|
||||
{
|
||||
vnThreadsRunning[THREAD_MESSAGEHANDLER]++;
|
||||
@@ -1852,6 +1883,9 @@ void static Discover()
|
||||
|
||||
void StartNode(void* parg)
|
||||
{
|
||||
// Make this thread recognisable as the startup thread
|
||||
RenameThread("bitcoin [start]");
|
||||
|
||||
if (semOutbound == NULL) {
|
||||
// initialize semaphore
|
||||
int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, (int)GetArg("-maxconnections", 125));
|
||||
|
||||
Reference in New Issue
Block a user