本文整理汇总了C++中ListRemove函数的典型用法代码示例。如果您正苦于以下问题:C++ ListRemove函数的具体用法?C++ ListRemove怎么用?C++ ListRemove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListRemove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListRemove
void CClientObjectManager::RemoveFromLists ( CClientObject* pObject )
{
if ( m_bCanRemoveFromList )
{
ListRemove ( m_Objects, pObject );
}
ListRemove ( m_StreamedIn, pObject );
}
示例2: ListRemove
void CSocketManager::SocketRemove(CSocket*& pSocket)
{
ListRemove(vecSockets, pSocket);
ListRemove(processQueue, pSocket);
pSocket->CloseSocketWithEvent();
ListRemove(deleteList, pSocket);
deleteList.push_back(pSocket);
}
示例3: schedule
/* Scheduler function
* First check the urgentQueue, if there is something
* in it then we remove it from the list and release the
* semaphore for it.
* If first check doesnt go through we do the exact same check
* for the enterQueue list & semaphore
* else we release the lock so if anything enters it goes right
* ahead. */
void schedule(){
if(ListCount(urgentQueue) > 0){
ListRemove(urgentQueue);
V(urgentSem);
}
else if(ListCount(enterQueue) > 0){
ListRemove(enterQueue);
V(enterSem);
}else{
isLocked = 0;
}
}
示例4: coalesce
int coalesce(LIST *free_list, DATA *d)
{
BLOCK *b1; BLOCK *b2;
/* Cursor is after free block just freed */
b2 = ListCurr(free_list);
b1 = ListPrev(free_list);
/* Cursor is on free block just freed */
/* Fringe case, free memory is at front of free list.
* Make b2 the coalesed node and delete b1.
*/
if (b1 == NULL)
{
b1 = b2;
b2 = ListNext(free_list);
if (b1->size + b1->address == b2->address)
{
b2->size = b2->size + b1->size;
b2->address = b2->address - b1->size;
ListPrev(free_list);
ListRemove(free_list);
d->operations_performed++;
return 1;
}
return 0;
}
else
{
/* Nodes are never inserted at the end of the list,
* so the only case is if the new free node has two
* adjacent nodes.
*/
while (b1 != NULL) {
if ((b1->address + b1->size == b2->address))
{
b2->address = b1->address;
b2->size = b1->size + b2->size;
/* Next node has all block data, cur node is
junk */
ListRemove(free_list);
d->operations_performed++;
}
b2 = ListCurr(free_list);
b1 = ListPrev(free_list);
}
return 1;
}
return -1;
}
示例5: MQTTProtocol_handlePubrels
/**
* Process an incoming pubrel packet for a socket
* @param pack pointer to the publish packet
* @param sock the socket on which the packet was received
* @return completion code
*/
int MQTTProtocol_handlePubrels(void* pack, int sock)
{
Pubrel* pubrel = (Pubrel*)pack;
Clients* client = NULL;
int rc = TCPSOCKET_COMPLETE;
FUNC_ENTRY;
client = (Clients*)(ListFindItem(bstate->clients, &sock, clientSocketCompare)->content);
Log(LOG_PROTOCOL, 17, NULL, sock, client->clientID, pubrel->msgId);
/* look for the message by message id in the records of inbound messages for this client */
if (ListFindItem(client->inboundMsgs, &(pubrel->msgId), messageIDCompare) == NULL)
{
if (pubrel->header.bits.dup == 0)
Log(TRACE_MIN, 3, NULL, "PUBREL", client->clientID, pubrel->msgId);
else
/* Apparently this is "normal" behaviour, so we don't need to issue a warning */
rc = MQTTPacket_send_pubcomp(pubrel->msgId, &client->net, client->clientID);
}
else
{
Messages* m = (Messages*)(client->inboundMsgs->current->content);
if (m->qos != 2)
Log(TRACE_MIN, 4, NULL, "PUBREL", client->clientID, pubrel->msgId, m->qos);
else if (m->nextMessageType != PUBREL)
Log(TRACE_MIN, 5, NULL, "PUBREL", client->clientID, pubrel->msgId);
else
{
Publish publish;
/* send pubcomp before processing the publications because a lot of return publications could fill up the socket buffer */
rc = MQTTPacket_send_pubcomp(pubrel->msgId, &client->net, client->clientID);
publish.header.bits.qos = m->qos;
publish.header.bits.retain = m->retain;
publish.msgId = m->msgid;
publish.topic = m->publish->topic;
publish.topiclen = m->publish->topiclen;
publish.payload = m->publish->payload;
publish.payloadlen = m->publish->payloadlen;
Protocol_processPublication(&publish, client);
#if !defined(NO_PERSISTENCE)
rc += MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_RECEIVED, m->qos, pubrel->msgId);
#endif
ListRemove(&(state.publications), m->publish);
ListRemove(client->inboundMsgs, m);
++(state.msgs_received);
}
}
free(pack);
FUNC_EXIT_RC(rc);
return rc;
}
示例6: MQTTProtocol_checkPendingWrites
/**
* See if any pending writes have been completed, and cleanup if so.
* Cleaning up means removing any publication data that was stored because the write did
* not originally complete.
*/
void MQTTProtocol_checkPendingWrites()
{
FUNC_ENTRY;
if (state.pending_writes.count > 0)
{
ListElement* le = state.pending_writes.first;
while (le)
{
pending_write* pw = (pending_write*)(le->content);
if (Socket_noPendingWrites(pw->socket))
{
Clients* client = pw->client;
MQTTProtocol_removePublication(pw->p);
state.pending_writes.current = le;
ListRemove(&(state.pending_writes), le->content); /* does NextElement itself */
le = state.pending_writes.current;
/* now we might be able to write the next message in the queue */
MQTTProtocol_processQueued(client);
}
else
ListNextElement(&(state.pending_writes), &le);
}
}
FUNC_EXIT;
}
示例7: MQTTProtocol_handlePubacks
/**
* Process an incoming puback packet for a socket
* @param pack pointer to the publish packet
* @param sock the socket on which the packet was received
* @return completion code
*/
int MQTTProtocol_handlePubacks(void* pack, int sock, Clients* client)
{
Puback* puback = (Puback*)pack;
//Clients* client = (Clients*)(TreeFind(bstate->clients, &sock)->content);
int rc = TCPSOCKET_COMPLETE;
FUNC_ENTRY;
Log(LOG_PROTOCOL, 14, NULL, sock, client->clientID, puback->msgId);
/* look for the message by message id in the records of outbound messages for this client */
if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL)
Log(LOG_WARNING, 50, NULL, "PUBACK", client->clientID, puback->msgId);
else
{
Messages* m = (Messages*)(client->outboundMsgs->current->content);
if (m->qos != 1)
Log(LOG_WARNING, 51, NULL, "PUBACK", client->clientID, puback->msgId, m->qos);
else
{
Log(TRACE_MIN, 4, NULL, client->clientID, puback->msgId);
++(bstate->msgs_sent);
bstate->bytes_sent += m->publish->payloadlen;
MQTTProtocol_removePublication(m->publish);
ListRemove(client->outboundMsgs, m);
/* now there is space in the inflight message queue we can process any queued messages */
MQTTProtocol_processQueued(client);
}
}
free(pack);
FUNC_EXIT_RC(rc);
return rc;
}
示例8: Socket_continueWrites
/**
* Continue any outstanding writes for a socket set
* @param pwset the set of sockets
* @return completion code
*/
int Socket_continueWrites(fd_set* pwset)
{
int rc1 = 0;
ListElement* curpending = s.write_pending->first;
FUNC_ENTRY;
while (curpending)
{
int socket = *(int*)(curpending->content);
if (FD_ISSET(socket, pwset) && Socket_continueWrite(socket))
{
if (!SocketBuffer_writeComplete(socket))
Log(LOG_SEVERE, -1, "Failed to remove pending write from socket buffer list");
FD_CLR(socket, &(s.pending_wset));
if (!ListRemove(s.write_pending, curpending->content))
{
Log(LOG_SEVERE, -1, "Failed to remove pending write from list");
ListNextElement(s.write_pending, &curpending);
}
curpending = s.write_pending->current;
if (writecomplete)
(*writecomplete)(socket);
}
else
ListNextElement(s.write_pending, &curpending);
}
FUNC_EXIT_RC(rc1);
return rc1;
}
示例9: MediaTerminateLock
////////////////////////////////////////////////////
// 功能: 结束某一任务的媒体播放,并锁定媒体播放任务
// 输入:
// 输出:
// 返回:
// 说明:
////////////////////////////////////////////////////
void MediaTerminateLock(HANDLE htask)
{
PMEDIA_OBJECT obj;
PLIST list;
kMutexWait(hMediaMutex);
list = &MediaObjList;
if(!ListEmpty(list))
{
// 获取正在音频任务节点
obj = ListEntry(ListFirst(list), MEDIA_OBJECT, Link);
if(obj->hTask == htask)
{
// 结束当前正在录放的音频任务
obj->Cb.MediaClose(obj->Media, 1);
obj->Cb.MediaDestroy(obj->Media);
ListRemove(&obj->Link);
HandleDestroy(obj->Header.Handle, MEDIA_MAGIC);
if(obj->MediaInfo)
kfree(obj->MediaInfo);
kfree(obj);
}
}
}
示例10: debugLogA
void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb)
{
debugLogA("Thread started: type=ibb_recv");
filetransfer *ft = jibb->ft;
jibb->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
jibb->bStreamClosed = FALSE;
jibb->wPacketId = 0;
jibb->dwTransferredSize = 0;
jibb->state = JIBB_RECVING;
WaitForSingleObject(jibb->hEvent, INFINITE);
CloseHandle(jibb->hEvent);
jibb->hEvent = NULL;
if (jibb->state == JIBB_ERROR)
m_ThreadInfo->send( XmlNodeIq(_T("set"), SerialNext(), jibb->dstJID) << XCHILDNS(_T("close"), JABBER_FEAT_IBB) << XATTR(_T("sid"), jibb->sid));
if (jibb->bStreamClosed && jibb->dwTransferredSize == ft->dwExpectedRecvFileSize)
jibb->state = JIBB_DONE;
(this->*jibb->pfnFinal)((jibb->state==JIBB_DONE)?TRUE:FALSE, jibb->ft);
jibb->ft = NULL;
ListRemove(LIST_FTRECV, jibb->sid);
JabberIbbFreeJibb(jibb);
}
示例11: ListPurgeFree
void ListPurgeFree(HSLIST &hList)
{
PLISTLINK lpCurr;
while ((lpCurr = ListRemove(hList)) != INVALID_SLIST_PTR)
SysFree(lpCurr);
}
示例12: MQTTProtocol_handlePubacks
/**
* Process an incoming puback packet for a socket
* @param pack pointer to the publish packet
* @param sock the socket on which the packet was received
* @return completion code
*/
int MQTTProtocol_handlePubacks(void* pack, int sock)
{
Puback* puback = (Puback*)pack;
Clients* client = NULL;
int rc = TCPSOCKET_COMPLETE;
FUNC_ENTRY;
client = (Clients*)(ListFindItem(bstate->clients, &sock, clientSocketCompare)->content);
Log(LOG_PROTOCOL, 14, NULL, sock, client->clientID, puback->msgId);
/* look for the message by message id in the records of outbound messages for this client */
if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL)
Log(TRACE_MIN, 3, NULL, "PUBACK", client->clientID, puback->msgId);
else
{
Messages* m = (Messages*)(client->outboundMsgs->current->content);
if (m->qos != 1)
Log(TRACE_MIN, 4, NULL, "PUBACK", client->clientID, puback->msgId, m->qos);
else
{
Log(TRACE_MIN, 6, NULL, "PUBACK", client->clientID, puback->msgId);
#if !defined(NO_PERSISTENCE)
rc = MQTTPersistence_remove(client, PERSISTENCE_PUBLISH_SENT, m->qos, puback->msgId);
#endif
MQTTProtocol_removePublication(m->publish);
ListRemove(client->outboundMsgs, m);
}
}
free(pack);
FUNC_EXIT_RC(rc);
return rc;
}
示例13: MQTTSProtocol_handlePubacks
int MQTTSProtocol_handlePubacks(void* pack, int sock, char* clientAddr, Clients* client)
{
int rc = 0;
MQTTS_PubAck* puback = (MQTTS_PubAck*)pack;
FUNC_ENTRY;
Log(LOG_PROTOCOL, 57, NULL, sock, clientAddr, client ? client->clientID : "", puback->msgId);
/* look for the message by message id in the records of outbound messages for this client */
if (ListFindItem(client->outboundMsgs, &(puback->msgId), messageIDCompare) == NULL)
Log(LOG_WARNING, 50, NULL, "PUBACK", client->clientID, puback->msgId);
else
{
Messages* m = (Messages*)(client->outboundMsgs->current->content);
if (m->qos != 1)
Log(LOG_WARNING, 51, NULL, "PUBACK", client->clientID, puback->msgId, m->qos);
else
{
Log(TRACE_MAX, 4, NULL, client->clientID, puback->msgId);
MQTTProtocol_removePublication(m->publish);
ListRemove(client->outboundMsgs, m);
/* TODO: msgs counts */
/* (++state.msgs_sent);*/
}
}
MQTTSPacket_free_packet(pack);
FUNC_EXIT_RC(rc);
return rc;
}
示例14: ListRemove
///////////////////////////////////////////////////////////////
//
// CResourceFileDownloadManager::UpdatePendingDownloads
//
// Figure which download group should be running
//
///////////////////////////////////////////////////////////////
void CResourceFileDownloadManager::UpdatePendingDownloads()
{
// Get download group to use
int iGroup = INVALID_DOWNLOAD_PRIORITY_GROUP;
if (!m_ActiveFileDownloadList.empty())
{
// Use active download group
iGroup = std::max(iGroup, m_ActiveFileDownloadList[0]->GetDownloadPriorityGroup());
}
else
{
// If no resource files being downloaded, find highest pending download group
for (auto pResourceFile : m_PendingFileDownloadList)
{
iGroup = std::max(iGroup, pResourceFile->GetDownloadPriorityGroup());
}
}
// Start (or add to) matching group
std::vector<CDownloadableResource*> pendingListCopy = m_PendingFileDownloadList;
for (auto pResourceFile : pendingListCopy)
{
if (pResourceFile->GetDownloadPriorityGroup() == iGroup)
{
// Move to active list and begin download
ListRemove(m_PendingFileDownloadList, pResourceFile);
m_ActiveFileDownloadList.push_back(pResourceFile);
BeginResourceFileDownload(pResourceFile, 0);
}
}
}
示例15: LockSimSystem
///////////////////////////////////////////////////////////////////////////
//
// CSimPlayerManager::RemoveSimPlayer
//
// Thread: main
// CS should be locked: no
//
// Delete matching sim player object
//
///////////////////////////////////////////////////////////////////////////
void CSimPlayerManager::RemoveSimPlayer ( CPlayer* pPlayer )
{
LockSimSystem (); // Prevent any sim activity on the sync thread
// Check
assert ( pPlayer->m_pSimPlayer->m_pRealPlayer == pPlayer );
CSimPlayer* pSim = pPlayer->m_pSimPlayer;
// Uninterlnk
pSim->m_pRealPlayer = NULL;
pPlayer->m_pSimPlayer = NULL;
// Move from lists
MapRemove ( m_AllSimPlayerMap, pSim );
MapRemove ( m_SocketSimMap, pSim->m_PlayerSocket );
// Remove outgoing sim from all dist lists
for ( std::set < CSimPlayer* > ::const_iterator iter = m_AllSimPlayerMap.begin () ; iter != m_AllSimPlayerMap.end (); ++iter )
{
CSimPlayer* pOtherSim = *iter;
ListRemove ( pOtherSim->m_PuresyncSendListFlat, pSim );
pOtherSim->m_bSendListChanged = true;
}
SAFE_DELETE( pSim );
UnlockSimSystem ();
}