Rename CreateThread to NewThread

Prevent clash with win32 API symbol
This commit is contained in:
Wladimir J. van der Laan 2012-08-29 20:25:37 +02:00
parent 61d8507140
commit 4d1d94c56c
9 changed files with 29 additions and 29 deletions

View file

@ -697,7 +697,7 @@ static void RPCAcceptHandler(boost::shared_ptr< basic_socket_acceptor<Protocol,
} }
// start HTTP client thread // start HTTP client thread
else if (!CreateThread(ThreadRPCServer3, conn)) { else if (!NewThread(ThreadRPCServer3, conn)) {
printf("Failed to create RPC server client thread\n"); printf("Failed to create RPC server client thread\n");
delete conn; delete conn;
} }

View file

@ -46,7 +46,7 @@ void StartShutdown()
uiInterface.QueueShutdown(); uiInterface.QueueShutdown();
#else #else
// Without UI, Shutdown() can simply be started in a new thread // Without UI, Shutdown() can simply be started in a new thread
CreateThread(Shutdown, NULL); NewThread(Shutdown, NULL);
#endif #endif
} }
@ -78,7 +78,7 @@ void Shutdown(void* parg)
boost::filesystem::remove(GetPidFile()); boost::filesystem::remove(GetPidFile());
UnregisterWallet(pwalletMain); UnregisterWallet(pwalletMain);
delete pwalletMain; delete pwalletMain;
CreateThread(ExitTimeout, NULL); NewThread(ExitTimeout, NULL);
Sleep(50); Sleep(50);
printf("Bitcoin exited\n\n"); printf("Bitcoin exited\n\n");
fExit = true; fExit = true;
@ -759,11 +759,11 @@ bool AppInit2()
printf("mapWallet.size() = %d\n", pwalletMain->mapWallet.size()); printf("mapWallet.size() = %d\n", pwalletMain->mapWallet.size());
printf("mapAddressBook.size() = %d\n", pwalletMain->mapAddressBook.size()); printf("mapAddressBook.size() = %d\n", pwalletMain->mapAddressBook.size());
if (!CreateThread(StartNode, NULL)) if (!NewThread(StartNode, NULL))
InitError(_("Error: could not start node")); InitError(_("Error: could not start node"));
if (fServer) if (fServer)
CreateThread(ThreadRPCServer, NULL); NewThread(ThreadRPCServer, NULL);
// ********************************************************* Step 11: finished // ********************************************************* Step 11: finished

View file

@ -4025,8 +4025,8 @@ void GenerateBitcoins(bool fGenerate, CWallet* pwallet)
printf("Starting %d BitcoinMiner threads\n", nAddThreads); printf("Starting %d BitcoinMiner threads\n", nAddThreads);
for (int i = 0; i < nAddThreads; i++) for (int i = 0; i < nAddThreads; i++)
{ {
if (!CreateThread(ThreadBitcoinMiner, pwallet)) if (!NewThread(ThreadBitcoinMiner, pwallet))
printf("Error: CreateThread(ThreadBitcoinMiner) failed\n"); printf("Error: NewThread(ThreadBitcoinMiner) failed\n");
Sleep(10); Sleep(10);
} }
} }

View file

@ -1125,7 +1125,7 @@ void MapPort()
{ {
if (fUseUPnP && vnThreadsRunning[THREAD_UPNP] < 1) if (fUseUPnP && vnThreadsRunning[THREAD_UPNP] < 1)
{ {
if (!CreateThread(ThreadMapPort, NULL)) if (!NewThread(ThreadMapPort, NULL))
printf("Error: ThreadMapPort(ThreadMapPort) failed\n"); printf("Error: ThreadMapPort(ThreadMapPort) failed\n");
} }
} }
@ -1887,7 +1887,7 @@ void static Discover()
// Don't use external IPv4 discovery, when -onlynet="IPv6" // Don't use external IPv4 discovery, when -onlynet="IPv6"
if (!IsLimited(NET_IPV4)) if (!IsLimited(NET_IPV4))
CreateThread(ThreadGetMyExternalIP, NULL); NewThread(ThreadGetMyExternalIP, NULL);
} }
void StartNode(void* parg) void StartNode(void* parg)
@ -1913,36 +1913,36 @@ void StartNode(void* parg)
if (!GetBoolArg("-dnsseed", true)) if (!GetBoolArg("-dnsseed", true))
printf("DNS seeding disabled\n"); printf("DNS seeding disabled\n");
else else
if (!CreateThread(ThreadDNSAddressSeed, NULL)) if (!NewThread(ThreadDNSAddressSeed, NULL))
printf("Error: CreateThread(ThreadDNSAddressSeed) failed\n"); printf("Error: NewThread(ThreadDNSAddressSeed) failed\n");
// Map ports with UPnP // Map ports with UPnP
if (fUseUPnP) if (fUseUPnP)
MapPort(); MapPort();
// Get addresses from IRC and advertise ours // Get addresses from IRC and advertise ours
if (!CreateThread(ThreadIRCSeed, NULL)) if (!NewThread(ThreadIRCSeed, NULL))
printf("Error: CreateThread(ThreadIRCSeed) failed\n"); printf("Error: NewThread(ThreadIRCSeed) failed\n");
// Send and receive from sockets, accept connections // Send and receive from sockets, accept connections
if (!CreateThread(ThreadSocketHandler, NULL)) if (!NewThread(ThreadSocketHandler, NULL))
printf("Error: CreateThread(ThreadSocketHandler) failed\n"); printf("Error: NewThread(ThreadSocketHandler) failed\n");
// Initiate outbound connections from -addnode // Initiate outbound connections from -addnode
if (!CreateThread(ThreadOpenAddedConnections, NULL)) if (!NewThread(ThreadOpenAddedConnections, NULL))
printf("Error: CreateThread(ThreadOpenAddedConnections) failed\n"); printf("Error: NewThread(ThreadOpenAddedConnections) failed\n");
// Initiate outbound connections // Initiate outbound connections
if (!CreateThread(ThreadOpenConnections, NULL)) if (!NewThread(ThreadOpenConnections, NULL))
printf("Error: CreateThread(ThreadOpenConnections) failed\n"); printf("Error: NewThread(ThreadOpenConnections) failed\n");
// Process messages // Process messages
if (!CreateThread(ThreadMessageHandler, NULL)) if (!NewThread(ThreadMessageHandler, NULL))
printf("Error: CreateThread(ThreadMessageHandler) failed\n"); printf("Error: NewThread(ThreadMessageHandler) failed\n");
// Dump network addresses // Dump network addresses
if (!CreateThread(ThreadDumpAddress, NULL)) if (!NewThread(ThreadDumpAddress, NULL))
printf("Error; CreateThread(ThreadDumpAddress) failed\n"); printf("Error; NewThread(ThreadDumpAddress) failed\n");
// Generate coins in the background // Generate coins in the background
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain); GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain);

View file

@ -152,7 +152,7 @@ void ipcInit(int argc, char *argv[])
return; return;
} }
if (!CreateThread(ipcThread, mq)) if (!NewThread(ipcThread, mq))
{ {
delete mq; delete mq;
return; return;

View file

@ -1302,9 +1302,9 @@ Value walletpassphrase(const Array& params, bool fHelp)
"walletpassphrase <passphrase> <timeout>\n" "walletpassphrase <passphrase> <timeout>\n"
"Stores the wallet decryption key in memory for <timeout> seconds."); "Stores the wallet decryption key in memory for <timeout> seconds.");
CreateThread(ThreadTopUpKeyPool, NULL); NewThread(ThreadTopUpKeyPool, NULL);
int64* pnSleepTime = new int64(params[1].get_int64()); int64* pnSleepTime = new int64(params[1].get_int64());
CreateThread(ThreadCleanWalletPassphrase, pnSleepTime); NewThread(ThreadCleanWalletPassphrase, pnSleepTime);
return Value::null; return Value::null;
} }

View file

@ -1300,7 +1300,7 @@ void RenameThread(const char* name)
#endif #endif
} }
bool CreateThread(void(*pfn)(void*), void* parg) bool NewThread(void(*pfn)(void*), void* parg)
{ {
try try
{ {

View file

@ -539,7 +539,7 @@ public:
} }
}; };
bool CreateThread(void(*pfn)(void*), void* parg); bool NewThread(void(*pfn)(void*), void* parg);
#ifdef WIN32 #ifdef WIN32
inline void SetThreadPriority(int nPriority) inline void SetThreadPriority(int nPriority)

View file

@ -1385,7 +1385,7 @@ int CWallet::LoadWallet(bool& fFirstRunRet)
return nLoadWalletRet; return nLoadWalletRet;
fFirstRunRet = !vchDefaultKey.IsValid(); fFirstRunRet = !vchDefaultKey.IsValid();
CreateThread(ThreadFlushWalletDB, &strWalletFile); NewThread(ThreadFlushWalletDB, &strWalletFile);
return DB_LOAD_OK; return DB_LOAD_OK;
} }