using namespace std;
-#include <iostream>
-
namespace Msp {
namespace IO {
void Base::set_events(PollEvent e)
{
- //cout<<"object "<<this<<" set_events "<<e<<'\n';
events=e;
signal_events_changed.emit(events);
}
#include "eventdispatcher.h"
#include "poll.h"
-#include <iostream>
-using namespace std;
-
namespace Msp {
namespace IO {
void EventDispatcher::add(Base &obj)
{
- //cout<<"evdisp add "<<&obj<<'\n';
SlotMap::iterator i=objects.find(&obj);
if(i==objects.end())
{
void EventDispatcher::remove(Base &obj)
{
- //cout<<"evdisp remove "<<&obj<<'\n';
SlotMap::iterator i=objects.find(&obj);
if(i!=objects.end())
{
if(ev)
obj.get_event_handle();
- //cout<<"poller set_object "<<&obj<<' '<<ev<<'\n';
-
SlotMap::iterator i=objects.find(&obj);
if(i!=objects.end())
{
poll_result.clear();
- if(pfd.empty())
- throw InvalidState("Nothing to poll");
-
#ifdef WIN32
if(timeout<0)
timeout=INFINITE;
- DWORD ret=WaitForMultipleObjects(pfd.size(), reinterpret_cast<HANDLE *>(&pfd.front()), false, timeout);
+ DWORD ret=WaitForMultipleObjects(pfd.size(), &pfd.front().fd, false, timeout);
if(/*ret>=WAIT_OBJECT_0 &&*/ ret<WAIT_OBJECT_0+pfd.size())
{
SlotMap::iterator i=objects.begin();