Exemple #1
0
bool VPoll::init()
{
    if (!notifier_->ready()) {
        if (!notifier_->init()) {
            return false;
        }
        IOCallback cb([this](KMEvent ev, void*, size_t) { notifier_->onEvent(ev); });
        registerFd(notifier_->getReadFD(), KUMA_EV_READ | KUMA_EV_ERROR, std::move(cb));
    }
    return true;
}
Exemple #2
0
bool KQueue::init()
{
    kqueue_fd_ = ::kqueue();
    if(INVALID_FD == kqueue_fd_) {
        return false;
    }
    if (!notifier_->ready()) {
        if(!notifier_->init()) {
            return false;
        }
        IOCallback cb ([this](uint32_t ev) { notifier_->onEvent(ev); });
        registerFd(notifier_->getReadFD(), KUMA_EV_READ|KUMA_EV_ERROR, std::move(cb));
    }
    return true;
}
Exemple #3
0
void SocketReactor::addEventHandler(const Socket& socket, const Poco::AbstractObserver& observer)
{
	NotifierPtr pNotifier;
	{
		FastMutex::ScopedLock lock(_mutex);
		
		EventHandlerMap::iterator it = _handlers.find(socket);
		if (it == _handlers.end())
		{
			pNotifier = new SocketNotifier(socket);
			_handlers[socket] = pNotifier;
		}
		else pNotifier = it->second;
	}
	pNotifier->addObserver(this, observer);
}
Exemple #4
0
void SocketReactor::removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer)
{
	NotifierPtr pNotifier;
	{
		FastMutex::ScopedLock lock(_mutex);
		
		EventHandlerMap::iterator it = _handlers.find(socket);
		if (it != _handlers.end())
		{
			pNotifier = it->second;
			if (pNotifier->countObservers() == 1)
			{
				_handlers.erase(it);
			}
		}
	}
	if (pNotifier)
	{
		pNotifier->removeObserver(this, observer);
	}
}
void SocketReactor::dispatch(NotifierPtr& pNotifier, SocketNotification* pNotification)
{
	try
	{
		pNotifier->dispatch(pNotification);
	}
	catch (Exception& exc)
	{
		ErrorHandler::handle(exc);
	}
	catch (std::exception& exc)
	{
		ErrorHandler::handle(exc);
	}
	catch (...)
	{
		ErrorHandler::handle();
	}
}
Exemple #6
0
void
ICSSW::__clearHandleUnsafe(NotifierPtr& p)
{
    p.__clearHandleUnsafe();
}
Exemple #7
0
void
ICSSW::__decRefUnsafe(const NotifierPtr& p)
{
    p->__decRefUnsafe();
}
Exemple #8
0
bool
ICSSW::__usesClasses(const NotifierPtr& p)
{
    return p->__usesClasses();
}
Exemple #9
0
void
ICSSW::__addObject(const NotifierPtr& p, ::IceInternal::GCCountMap& c)
{
    p->__addObject(c);
}
Exemple #10
0
void KQueue::notify()
{
    notifier_->notify();
}
Exemple #11
0
void VPoll::notify()
{
    notifier_->notify();
}