Example #1
0
File: VPoll.cpp Project: Jamol/kuma
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;
}
Example #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;
}
Example #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);
}
Example #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();
	}
}
Example #6
0
void
ICSSW::__clearHandleUnsafe(NotifierPtr& p)
{
    p.__clearHandleUnsafe();
}
Example #7
0
void
ICSSW::__decRefUnsafe(const NotifierPtr& p)
{
    p->__decRefUnsafe();
}
Example #8
0
bool
ICSSW::__usesClasses(const NotifierPtr& p)
{
    return p->__usesClasses();
}
Example #9
0
void
ICSSW::__addObject(const NotifierPtr& p, ::IceInternal::GCCountMap& c)
{
    p->__addObject(c);
}
Example #10
0
void KQueue::notify()
{
    notifier_->notify();
}
Example #11
0
File: VPoll.cpp Project: Jamol/kuma
void VPoll::notify()
{
    notifier_->notify();
}