X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Futil.h;h=dc40af5e02e52860946b70d1078946028633efaf;hb=0561bbd1c69263dceb24ffacf850788e6e961a13;hp=714084e41077e42c47f7f18f73458bd933190537;hpb=28a498d5a6794bce952fe8a1938720b73946c1d8;p=novacoin.git diff --git a/src/util.h b/src/util.h index 714084e..dc40af5 100644 --- a/src/util.h +++ b/src/util.h @@ -1,7 +1,8 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers +// Copyright (c) 2012 The PPCoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_UTIL_H #define BITCOIN_UTIL_H @@ -36,8 +37,8 @@ typedef int pid_t; /* define for windows compatiblity */ typedef long long int64; typedef unsigned long long uint64; -static const int64 COIN = 100000000; -static const int64 CENT = 1000000; +static const int64 COIN = 1000000; +static const int64 CENT = 10000; #define loop for (;;) #define BEGIN(a) ((char*)&(a)) @@ -103,8 +104,14 @@ inline void Sleep(int64 n) } #endif - - +#ifndef THROW_WITH_STACKTRACE +#define THROW_WITH_STACKTRACE(exception) \ +{ \ + LogStackTrace(); \ + throw (exception); \ +} +void LogStackTrace(); +#endif @@ -218,9 +225,11 @@ public: { printf("LOCKCONTENTION: %s\n", pszName); printf("Locker: %s:%d\n", pszFile, nLine); - } #endif lock.lock(); +#ifdef DEBUG_LOCKCONTENTION + } +#endif } } @@ -659,9 +668,9 @@ public: // Note: It turns out we might have been able to use boost::thread // by using TerminateThread(boost::thread.native_handle(), 0); #ifdef WIN32 -typedef HANDLE pthread_t; +typedef HANDLE bitcoin_pthread_t; -inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) +inline bitcoin_pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=false) { DWORD nUnused = 0; HANDLE hthread = @@ -675,12 +684,12 @@ inline pthread_t CreateThread(void(*pfn)(void*), void* parg, bool fWantHandle=fa if (hthread == NULL) { printf("Error: CreateThread() returned %d\n", GetLastError()); - return (pthread_t)0; + return (bitcoin_pthread_t)0; } if (!fWantHandle) { CloseHandle(hthread); - return (pthread_t)-1; + return (bitcoin_pthread_t)-1; } return hthread; }