diff options
author | Eric Lombrozo <elombrozo@gmail.com> | 2014-10-19 04:46:17 -0400 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-01-28 07:41:54 +0100 |
commit | 4401b2d7c52e0f3841225369fb0d10767c51aaa2 (patch) | |
tree | 29b0b989569f1a16cba69c287a30e0db220343b6 /src/sync.h | |
parent | 6b5f5294bba0448c0349ad41cd0e7e107a500b9d (diff) |
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 7891e41560..27e80e813b 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()) |