本文整理汇总了C++中ledger::pointer::setImmutable方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::setImmutable方法的具体用法?C++ pointer::setImmutable怎么用?C++ pointer::setImmutable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ledger::pointer
的用法示例。
在下文中一共展示了pointer::setImmutable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findCreate
InboundLedger::pointer InboundLedgers::findCreate (uint256 const& hash, uint32 seq)
{
assert (hash.isNonZero ());
boost::mutex::scoped_lock sl (mLock);
InboundLedger::pointer& ptr = mLedgers[hash];
if (ptr)
{
ptr->touch ();
return ptr;
}
ptr = boost::make_shared<InboundLedger> (hash, seq);
if (!ptr->isDone ())
{
ptr->addPeers ();
ptr->setTimer (); // Cannot call in constructor
}
else
{
Ledger::pointer ledger = ptr->getLedger ();
ledger->setClosed ();
ledger->setImmutable ();
theApp->getLedgerMaster ().storeLedger (ledger);
WriteLog (lsDEBUG, InboundLedger) << "Acquiring ledger we already have: " << hash;
}
return ptr;
}
示例2: findCreate
InboundLedger::pointer InboundLedgers::findCreate (uint256 const& hash, uint32 seq)
{
assert (hash.isNonZero ());
InboundLedger::pointer ret;
{
boost::mutex::scoped_lock sl (mLock);
boost::unordered_map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
if (it != mLedgers.end ())
{
ret = it->second;
// FIXME: Should set the sequence if it's not set
}
else
{
ret = boost::make_shared<InboundLedger> (hash, seq);
assert (ret);
mLedgers.insert (std::make_pair (hash, ret));
if (!ret->tryLocal())
{
ret->addPeers ();
ret->setTimer (); // Cannot call in constructor
}
else if (!ret->isFailed ())
{
WriteLog (lsDEBUG, InboundLedger) << "Acquiring ledger we already have locally: " << hash;
Ledger::pointer ledger = ret->getLedger ();
ledger->setClosed ();
ledger->setImmutable ();
getApp().getLedgerMaster ().storeLedger (ledger);
}
}
}
return ret;
}