本文整理汇总了C++中TItem类的典型用法代码示例。如果您正苦于以下问题:C++ TItem类的具体用法?C++ TItem怎么用?C++ TItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TItem类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: locallock
int CUdpCast::SendInternal(const BYTE* pBuffer, int iLength)
{
int result = NO_ERROR;
if(HasStarted())
{
CCriSecLock locallock(m_csSend);
if(HasStarted())
{
ASSERT(m_iPending >= 0);
BOOL isPending = m_iPending > 0;
TItem* pItem = m_itPool.PickFreeItem();
pItem->Cat(pBuffer, iLength);
m_lsSend.PushBack(pItem);
m_iPending += iLength;
if(!isPending) m_evBuffer.Set();
}
else
result = ERROR_INVALID_STATE;
}
else
result = ERROR_INVALID_STATE;
return result;
}
开发者ID:xiaxiaoyun926,项目名称:HP-Socket,代码行数:30,代码来源:UdpCast.cpp
示例2: PickFreeItem
TItem* CItemPool::PickFreeItem()
{
TItem* pItem = nullptr;
if(m_lsFreeItem.TryGet(&pItem))
pItem->Reset();
else
pItem = TItem::Construct(m_heap, m_dwItemCapacity);
return pItem;
}
开发者ID:AngusLean,项目名称:HP-Socket,代码行数:11,代码来源:bufferpool.cpp
示例3: CatAndPost
int CUdpServer::CatAndPost(TUdpSocketObj* pSocketObj, const BYTE* pBuffer, int iLength, BOOL isPostSend)
{
int result = NO_ERROR;
TItem* pItem = m_itPool.PickFreeItem();
pItem->Cat(pBuffer, iLength);
pSocketObj->sndBuff.PushBack(pItem);
pSocketObj->pending += iLength;
if(isPostSend && !::PostIocpSend(m_hCompletePort, pSocketObj->connID))
result = ::GetLastError();
return result;
}
开发者ID:grasswin,项目名称:HP-Socket,代码行数:14,代码来源:UdpServer.cpp
示例4: while
int TItemList::Reduce(int length)
{
int remain = length;
while(remain > 0 && Size() > 0)
{
TItem* pItem = Front();
remain -= pItem->Reduce(remain);
if(pItem->IsEmpty())
itPool.PutFreeItem(PopFront());
}
return length - remain;
}
开发者ID:NothingInMyEye,项目名称:HP-Socket,代码行数:15,代码来源:bufferpool.cpp
示例5: Front
int TItemList::Peek(BYTE* pData, int length)
{
int remain = length;
TItem* pItem = Front();
while(remain > 0 && pItem != nullptr)
{
int peek = pItem->Peek(pData, remain);
pData += peek;
remain -= peek;
pItem = pItem->next;
}
return length - remain;
}
开发者ID:NothingInMyEye,项目名称:HP-Socket,代码行数:16,代码来源:bufferpool.cpp
示例6: locallock
TItem* CItemPool::PickFreeItem()
{
TItem* pItem = nullptr;
if(m_lsFreeItem.Size() > 0)
{
CCriSecLock locallock(m_csFreeItem);
if(m_lsFreeItem.Size() > 0)
pItem = m_lsFreeItem.PopFront();
}
if(pItem == nullptr)
pItem = TItem::Construct(m_heap, m_dwItemCapacity);
else
pItem->Reset();
return pItem;
}
开发者ID:NothingInMyEye,项目名称:HP-Socket,代码行数:19,代码来源:bufferpool.cpp
示例7: ASSERT
BOOL CUdpServer::Send(CONNID dwConnID, const BYTE* pBuffer, int iLength, int iOffset)
{
ASSERT(pBuffer && iLength > 0 && iLength <= (int)m_dwMaxDatagramSize);
if(iOffset != 0) pBuffer += iOffset;
if(!pBuffer || iLength <= 0 || iLength > (int)m_dwMaxDatagramSize)
{
::SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
int result = NO_ERROR;
TUdpSocketObj* pSocketObj = FindSocketObj(dwConnID);
if(!TUdpSocketObj::IsValid(pSocketObj))
result = ERROR_OBJECT_NOT_FOUND;
else
{
CCriSecLock locallock(pSocketObj->crisec);
if(!TUdpSocketObj::IsValid(pSocketObj))
result = ERROR_OBJECT_NOT_FOUND;
else
{
BOOL isPending = TUdpSocketObj::IsPending(pSocketObj);
TItem* pItem = m_itPool.PickFreeItem();
pItem->Cat(pBuffer, iLength);
pSocketObj->sndBuff.PushBack(pItem);
pSocketObj->pending += iLength;
if(!isPending && !::PostIocpSend(m_hCompletePort, dwConnID))
result = ::GetLastError();
}
}
if(result != NO_ERROR)
::SetLastError(result);
return (result == NO_ERROR);
}
开发者ID:cxc3214,项目名称:HP-Socket,代码行数:42,代码来源:UdpServer.cpp
示例8: pop
virtual TItem* pop() {
TItem* item = 0;
if ((item = first_)) {
TItem* next = 0;
if ((next = item->next()))
next->set_prev(0);
else last_ = 0;
first_ = next;
item->set_next(0);
item->set_prev(0);
}
return item;
}
开发者ID:medusade,项目名称:nadir,代码行数:16,代码来源:list.hpp
示例9: pull
virtual TItem* pull() {
TItem* item = 0;
if ((item = last_)) {
TItem* prev = 0;
if ((prev = item->prev()))
prev->set_next(0);
else first_ = 0;
last_ = prev;
item->set_next(0);
item->set_prev(0);
}
return item;
}
开发者ID:medusade,项目名称:nadir,代码行数:16,代码来源:list.hpp
示例10: Cat
inline int TItem::Cat(const TItem& other)
{
ASSERT(this != &other);
return Cat(other.Ptr(), other.Size());
}
开发者ID:NothingInMyEye,项目名称:HP-Socket,代码行数:5,代码来源:bufferpool.cpp
注:本文中的TItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论