本文整理汇总了C++中EventHandler::getNativeInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ EventHandler::getNativeInfo方法的具体用法?C++ EventHandler::getNativeInfo怎么用?C++ EventHandler::getNativeInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventHandler
的用法示例。
在下文中一共展示了EventHandler::getNativeInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: out
void
Selector::updateSelector()
{
#if defined(ICE_USE_KQUEUE)
int rs = kevent(_queueFd, &_changes[0], _changes.size(), 0, 0, 0);
if(rs < 0)
{
Ice::Error out(_instance->initializationData().logger);
out << "error while updating selector:\n" << IceUtilInternal::errorToString(IceInternal::getSocketErrno());
}
_changes.clear();
#elif !defined(ICE_USE_EPOLL)
assert(!_selecting);
for(vector<pair<EventHandler*, SocketOperation> >::const_iterator p = _changes.begin(); p != _changes.end(); ++p)
{
EventHandler* handler = p->first;
SocketOperation status = p->second;
SOCKET fd = handler->getNativeInfo()->fd();
if(status)
{
#if defined(ICE_USE_SELECT)
if(status & SocketOperationRead)
{
FD_SET(fd, &_readFdSet);
}
else
{
FD_CLR(fd, &_readFdSet);
}
if(status & SocketOperationWrite)
{
FD_SET(fd, &_writeFdSet);
}
else
{
FD_CLR(fd, &_writeFdSet);
}
if(status & SocketOperationConnect)
{
FD_SET(fd, &_writeFdSet);
FD_SET(fd, &_errorFdSet);
}
else
{
FD_CLR(fd, &_writeFdSet);
FD_CLR(fd, &_errorFdSet);
}
_handlers[fd] = handler;
#else
short events = 0;
if(status & SocketOperationRead)
{
events |= POLLIN;
}
if(status & SocketOperationWrite)
{
events |= POLLOUT;
}
map<SOCKET, EventHandler*>::const_iterator q = _handlers.find(fd);
if(q == _handlers.end())
{
struct pollfd pollFd;
pollFd.fd = fd;
pollFd.events = events;
pollFd.revents = 0;
_pollFdSet.push_back(pollFd);
_handlers.insert(make_pair(fd, handler));
}
else
{
for(vector<struct pollfd>::iterator r = _pollFdSet.begin(); r != _pollFdSet.end(); ++r)
{
if(r->fd == fd)
{
r->events = events;
break;
}
}
}
#endif
}
else
{
#if defined(ICE_USE_SELECT)
FD_CLR(fd, &_readFdSet);
FD_CLR(fd, &_writeFdSet);
FD_CLR(fd, &_errorFdSet);
#else
for(vector<struct pollfd>::iterator r = _pollFdSet.begin(); r != _pollFdSet.end(); ++r)
{
if(r->fd == fd)
{
_pollFdSet.erase(r);
break;
}
}
#endif
_handlers.erase(fd);
//.........这里部分代码省略.........