diff options
author | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-10-19 17:16:51 +0000 |
---|---|---|
committer | s_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b> | 2010-10-19 17:16:51 +0000 |
commit | 5cbf75324d1509a1262b65c5073314a4da3f6d77 (patch) | |
tree | fcaaca0e6f71362c3968735b29ea8e2e7fff9dbb /util.h | |
parent | 2fad3d34b7b9bf03d56970cb36d9a091609b10c8 (diff) |
Gavin's TEST network as -testnet switch, misc fixes
git-svn-id: https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk@168 1a98c847-1fd6-4fd8-948a-caf3550aa51b
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -145,6 +145,7 @@ extern bool fShutdown; extern bool fDaemon; extern bool fCommandLine; extern string strMiscWarning; +extern bool fTestNet; void RandAddSeed(); void RandAddSeedPerfmon(); @@ -621,3 +622,27 @@ inline void ExitThread(unsigned int nExitCode) pthread_exit((void*)nExitCode); } #endif + + + + + +inline bool AffinityBugWorkaround(void(*pfn)(void*)) +{ +#ifdef __WXMSW__ + // Sometimes after a few hours affinity gets stuck on one processor + DWORD dwProcessAffinityMask = -1; + DWORD dwSystemAffinityMask = -1; + GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinityMask, &dwSystemAffinityMask); + DWORD dwPrev1 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); + DWORD dwPrev2 = SetThreadAffinityMask(GetCurrentThread(), dwProcessAffinityMask); + if (dwPrev2 != dwProcessAffinityMask) + { + printf("AffinityBugWorkaround() : SetThreadAffinityMask=%d, ProcessAffinityMask=%d, restarting thread\n", dwPrev2, dwProcessAffinityMask); + if (!CreateThread(pfn, NULL)) + printf("Error: CreateThread() failed\n"); + return true; + } +#endif + return false; +} |