Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Macros | Typedefs | Functions
sync.h File Reference
#include "threadsafety.h"
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
+ Include dependency graph for sync.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AnnotatedMixin< PARENT >
 
class  CMutexLock< Mutex >
 Wrapper around boost::unique_lock<Mutex> More...
 
class  CSemaphore
 
class  CSemaphoreGrant
 RAII-style semaphore lock. More...
 

Macros

#define AssertLockHeld(cs)   AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
 
#define LOCK(cs)   CCriticalBlock criticalblock(cs, #cs, __FILE__, __LINE__)
 
#define LOCK2(cs1, cs2)   CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__),criticalblock2(cs2, #cs2, __FILE__, __LINE__)
 
#define TRY_LOCK(cs, name)   CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)
 
#define ENTER_CRITICAL_SECTION(cs)
 
#define LEAVE_CRITICAL_SECTION(cs)
 

Typedefs

typedef AnnotatedMixin< boost::recursive_mutex > CCriticalSection
 Wrapped boost mutex: supports recursive locking, but no waiting. More...
 
typedef AnnotatedMixin< boost::mutex > CWaitableCriticalSection
 Wrapped boost mutex: supports waiting but not recursive locking. More...
 
typedef CMutexLock< CCriticalSectionCCriticalBlock
 

Functions

static void EnterCritical (const char *pszName, const char *pszFile, int nLine, void *cs, bool fTry=false)
 
static void LeaveCritical ()
 
static void AssertLockHeldInternal (const char *pszName, const char *pszFile, int nLine, void *cs)
 

Macro Definition Documentation

#define AssertLockHeld (   cs)    AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
#define ENTER_CRITICAL_SECTION (   cs)
Value:
{ \
EnterCritical(#cs, __FILE__, __LINE__, (void*)(&cs)); \
(cs).lock(); \
}
static void EnterCritical(const char *pszName, const char *pszFile, int nLine, void *cs, bool fTry=false)
Definition: sync.h:93

Definition at line 160 of file sync.h.

Referenced by CNode::BeginMessage(), and locking_callback().

#define LEAVE_CRITICAL_SECTION (   cs)
Value:
{ \
(cs).unlock(); \
}
static void LeaveCritical()
Definition: sync.h:94

Definition at line 166 of file sync.h.

Referenced by CNode::AbortMessage(), CNode::EndMessage(), and locking_callback().

#define LOCK (   cs)    CCriticalBlock criticalblock(cs, #cs, __FILE__, __LINE__)

Definition at line 156 of file sync.h.

Referenced by AcceptBlock(), AcceptToMemoryPool(), ActivateBestChain(), CAddrMan::Add(), CCryptoKeyStore::AddCryptedKey(), CWallet::AddCryptedKey(), CBasicKeyStore::AddCScript(), CNode::AddInventoryKnown(), CBasicKeyStore::AddKeyPubKey(), CCryptoKeyStore::AddKeyPubKey(), AddLocal(), addnode(), AddOneShot(), AddressTableModel::addRow(), AddTimeData(), AddToBlockIndex(), CWallet::AddToWallet(), CTxMemPool::AddTransactionsUpdated(), CTxMemPool::addUnchecked(), AdvertizeLocal(), CAddrMan::Attempt(), BackupWallet(), CNode::Ban(), CDB::CDB(), WalletModel::changePassphrase(), CWallet::ChangeWalletPassphrase(), CTxMemPool::check(), CAddrMan::Check(), mastercore::ClassB_send(), CTxMemPool::clear(), CDB::Close(), CDBEnv::CloseDb(), CNode::CNode(), CAddrMan::Connected(), ConnectNode(), CopyNodeStats(), CWallet::DelAddressBook(), CCryptoKeyStore::EncryptKeys(), CWallet::EncryptWallet(), CWallet::EraseFromWallet(), CRPCTable::execute(), CTxMemPool::exists(), PaymentServer::fetchPaymentACK(), MatrixModel::fillin(), FindBlockPos(), FindNode(), FindUndoPos(), CWalletDB::FindWalletTx(), CDBEnv::Flush(), FlushBlockFile(), CWalletTx::GetAccountAmounts(), getaddednodeinfo(), CAddrMan::GetAddr(), CWallet::GetAddressBalances(), CAlert::getAlertByHash(), getconnectioncount(), CBasicKeyStore::GetCScript(), GetDataDir(), CWallet::GetDebit(), mastercore::GetHeight(), CBasicKeyStore::GetKey(), CCryptoKeyStore::GetKey(), CWallet::GetKeyFromPool(), CBasicKeyStore::GetKeys(), getLabel(), ClientModel::getLastBlockDate(), mastercore::GetLatestBlockTime(), GetLocal(), CMPTally::getMoney(), getMPbalance(), GetNameProxy(), getnetworkinfo(), GetNodeStateStats(), ClientModel::getNumBlocks(), ClientModel::getNumConnections(), WalletModel::getNumTransactions(), GetProxy(), CCryptoKeyStore::GetPubKey(), getrawmempool(), CWalletTx::GetRequestCount(), mastercore::getTally(), GetTimeOffset(), CNode::GetTotalBytesRecv(), CNode::GetTotalBytesSent(), mastercore::getTotalTokens(), GetTransaction(), CTxMemPool::GetTransactionsUpdated(), gettxout(), ClientModel::getVerificationProgress(), CWallet::GetVersion(), CWallet::GetWalletTx(), GetWarnings(), CAddrMan::Good(), CBasicKeyStore::HaveCScript(), CBasicKeyStore::HaveKey(), CCryptoKeyStore::HaveKey(), HaveNameProxy(), CAddrMan::IMPLEMENT_SERIALIZE(), InitBlockIndex(), CWallet::Inventory(), CNode::IsBanned(), CWallet::IsChange(), IsInitialBlockDownload(), IsLimited(), IsLocal(), CCryptoKeyStore::IsLocked(), CWallet::IsMine(), IsProxy(), IsReachable(), AddressTableModel::labelForAddress(), listaddressgroupings(), listtransactions_MP(), LoadExternalBlockFile(), WalletModel::loadReceiveRequests(), CWalletDB::LoadWallet(), CWallet::LoadWallet(), CCryptoKeyStore::Lock(), LockWallet(), CTxMemPool::lookup(), CWallet::MarkDirty(), CWallet::NewKeyPool(), ping(), CAlert::ProcessAlert(), ProcessGetData(), ProcessMessage(), ProcessOneShot(), CTxMemPool::pruneSpent(), CNode::PushInventory(), CTxMemPool::queryHashes(), CWallet::ReacceptWalletTransactions(), CNode::RecordBytesRecv(), CNode::RecordBytesSent(), AddressTablePriv::refreshAddressTable(), msc_AddressTablePriv::refreshAddressTable(), RelayTransaction(), CTxMemPool::remove(), CTxMemPool::removeConflicts(), CDBEnv::RemoveDb(), AddressTableModel::removeRows(), CWalletDB::ReorderTransactions(), CWallet::ResendWalletTransactions(), CWallet::ReserveKeyFromKeyPool(), CWallet::ReturnKey(), CDB::Rewrite(), CDBEnv::Salvage(), WalletModel::saveReceiveRequest(), SeenLocal(), CAddrMan::Select(), selectCoins(), WalletModel::sendCoins(), SendMessages(), CWallet::SetAddressBook(), CCryptoKeyStore::SetCrypted(), AddressTableModel::setData(), SetLimited(), CWallet::SetMaxVersion(), CWallet::SetMinVersion(), SetNameProxy(), SetProxy(), SetReachable(), Shutdown(), signrawtransaction(), CTxMemPool::size(), ThreadDNSAddressSeed(), ThreadMessageHandler(), ThreadOpenAddedConnections(), ThreadOpenConnections(), ThreadSocketHandler(), CWallet::TopUpKeyPool(), CCryptoKeyStore::Unlock(), CWallet::Unlock(), mastercore::update_tally_map(), CWallet::UpdatedTransaction(), CMPTally::updateMoney(), SendMPDialog::updateProperty(), CDBEnv::Verify(), VerifyDB(), walletlock(), walletpassphrase(), write_msc_balances(), and CWallet::ZapWalletTx().

#define LOCK2 (   cs1,
  cs2 
)    CCriticalBlock criticalblock1(cs1, #cs1, __FILE__, __LINE__),criticalblock2(cs2, #cs2, __FILE__, __LINE__)
#define TRY_LOCK (   cs,
  name 
)    CCriticalBlock name(cs, #cs, __FILE__, __LINE__, true)

Typedef Documentation

Definition at line 154 of file sync.h.

typedef AnnotatedMixin<boost::recursive_mutex> CCriticalSection

Wrapped boost mutex: supports recursive locking, but no waiting.

Definition at line 82 of file sync.h.

Wrapped boost mutex: supports waiting but not recursive locking.

Definition at line 85 of file sync.h.

Function Documentation

static void AssertLockHeldInternal ( const char *  pszName,
const char *  pszFile,
int  nLine,
void *  cs 
)
inlinestatic

Definition at line 95 of file sync.h.

static void EnterCritical ( const char *  pszName,
const char *  pszFile,
int  nLine,
void *  cs,
bool  fTry = false 
)
inlinestatic

Definition at line 93 of file sync.h.

Referenced by CMutexLock< Mutex >::Enter(), and CMutexLock< Mutex >::TryEnter().

+ Here is the caller graph for this function:

static void LeaveCritical ( )
inlinestatic

Definition at line 94 of file sync.h.

Referenced by CMutexLock< Mutex >::TryEnter(), and CMutexLock< Mutex >::~CMutexLock().

+ Here is the caller graph for this function: