本文整理汇总了C++中CBuffer::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::Release方法的具体用法?C++ CBuffer::Release怎么用?C++ CBuffer::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::Release方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
CBuffer *CPackager::GetNextPack( BYTE cID )
{
CCriticalSection::Owner lock( m_csSend );
BUFFER_MAP::iterator it;
if ( m_theSend.end() != ( it = m_theSend.find( cID ) ) )
{
CBuffer *pBuffer = m_theSend[cID];
CBuffer *pPack = pBuffer->GetNextPack();
if ( NULL == pPack )
{
return NULL;
}
if ( 0 == pPack->GetUsed() )
{
pPack->Release();
return NULL;
}
CBuffer *pNewBufer = m_theAllocator.Allocate();
pNewBufer->AddData( cID );
BYTE cFlag = enumPackMiddle;
if ( !pBuffer->HaveNextPack() )
{
cFlag |= enumPackTail;
}
pNewBufer->AddData( cFlag );
/*
* Add a user data into this buffer
*/
unsigned long lnUserData = pBuffer->GetUserData();
pNewBufer->AddData( ( const char * )( &lnUserData ), sizeof( unsigned long ) );
/*
* Add some data into this buffer
*/
pNewBufer->AddData( pPack->GetBuffer(), pPack->GetUsed() );
pPack->Release();
return pNewBufer;
}
return NULL;
}
示例2: lock
CBuffer *CClientNode::CDataQueue::Get()
{
{
CCriticalSection::Owner lock( m_csQueue );
if ( !m_theData.empty() )
{
CBuffer *pBuffer = m_theData.front();
pBuffer->AddRef();
m_theData.pop_front();
pBuffer->Release();
return pBuffer;
}
}
return NULL;
}