本文整理汇总了C++中utArray::back方法的典型用法代码示例。如果您正苦于以下问题:C++ utArray::back方法的具体用法?C++ utArray::back怎么用?C++ utArray::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utArray
的用法示例。
在下文中一共展示了utArray::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: socketListeningThread
// Entry point for the socket thread. Listen for connections and incoming data,
// and route it to the protocol handlers.
static int socketListeningThread(void *payload)
{
// Listen for incoming connections.
int listenPort = 12340;
gListenSocket = (loom_socketId_t)-1;
for ( ; ; )
{
gListenSocket = loom_net_listenTCPSocket(listenPort);
if (gListenSocket != (loom_socketId_t)-1)
{
break;
}
lmLogWarn(gAssetAgentLogGroup, " - Failed to acquire port %d, trying port %d", listenPort, listenPort + 1);
listenPort++;
}
lmLog(gAssetAgentLogGroup, "Listening on port %d", listenPort);
while (loom_socketId_t acceptedSocket = loom_net_acceptTCPSocket(gListenSocket))
{
// Check to see if we got anybody...
if (!acceptedSocket || ((int)(long)acceptedSocket == -1))
{
// Process the connections.
loom_mutex_lock(gActiveSocketsMutex);
for (UTsize i = 0; i < gActiveHandlers.size(); i++)
{
AssetProtocolHandler* aph = gActiveHandlers[i];
aph->process();
// Check for ping timeout
int msSincePing = loom_readTimer(aph->lastActiveTime);
if (msSincePing > socketPingTimeoutMs)
{
gActiveHandlers.erase(i);
i--;
lmLog(gAssetAgentLogGroup, "Client timed out (%x)", aph->socket);
loom_net_closeTCPSocket(aph->socket);
lmDelete(NULL, aph);
}
}
loom_mutex_unlock(gActiveSocketsMutex);
loom_thread_sleep(10);
continue;
}
lmLog(gAssetAgentLogGroup, "Client connected (%x)", acceptedSocket);
loom_mutex_lock(gActiveSocketsMutex);
gActiveHandlers.push_back(lmNew(NULL) AssetProtocolHandler(acceptedSocket));
AssetProtocolHandler *handler = gActiveHandlers.back();
handler->registerListener(lmNew(NULL) TelemetryListener());
if (TelemetryServer::isRunning()) handler->sendCommand("telemetryEnable");
// Send it all of our files.
// postAllFiles(gActiveHandlers[gActiveHandlers.size()-1]->getId());
loom_mutex_unlock(gActiveSocketsMutex);
}
return 0;
}