diff options
| author | Eric Lombrozo <[email protected]> | 2014-10-19 04:46:17 -0400 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-01-28 07:41:54 +0100 |
| commit | 4401b2d7c52e0f3841225369fb0d10767c51aaa2 (patch) | |
| tree | 29b0b989569f1a16cba69c287a30e0db220343b6 /src/sync.h | |
| parent | Merge pull request #5506 (diff) | |
| download | discoin-4401b2d7c52e0f3841225369fb0d10767c51aaa2.tar.xz discoin-4401b2d7c52e0f3841225369fb0d10767c51aaa2.zip | |
Removed main.h dependency from rpcserver.cpp
Rebased by @laanwj:
- update for RPC methods added since 84d13ee: setmocktime,
invalidateblock, reconsiderblock. Only the first, setmocktime, required a change,
the other two are thread safe.
Diffstat (limited to 'src/sync.h')
| -rw-r--r-- | src/sync.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h index 7891e4156..27e80e813 100644 --- a/src/sync.h +++ b/src/sync.h @@ -142,6 +142,17 @@ public: Enter(pszName, pszFile, nLine); } + CMutexLock(Mutex* pmutexIn, const char* pszName, const char* pszFile, int nLine, bool fTry = false) + { + if (!pmutexIn) return; + + lock = boost::unique_lock<Mutex>(*pmutexIn, boost::defer_lock); + if (fTry) + TryEnter(pszName, pszFile, nLine); + else + Enter(pszName, pszFile, nLine); + } + ~CMutexLock() { if (lock.owns_lock()) |