X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fpollable.cpp;fp=source%2Fcore%2Fpollable.cpp;h=4db38dd70ac222823b039ab466acd98a409fd595;hb=e1ea831a640fba534e7e42e399f04cdf681ef8d3;hp=0000000000000000000000000000000000000000;hpb=0bcb8d4d6f33cbdad7b921cac787740bfe8e212e;p=libs%2Fcore.git diff --git a/source/core/pollable.cpp b/source/core/pollable.cpp new file mode 100644 index 0000000..4db38dd --- /dev/null +++ b/source/core/pollable.cpp @@ -0,0 +1,29 @@ +/* +This file is part of libmspframework +Copyright © 2006 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ +#ifdef WIN32 +#include +#include "win32poll.h" +#else +#include +#endif +#include "pollable.h" + +namespace Msp { + +short Pollable::poll(short events, int timeout) +{ +#ifdef WIN32 + return 0; +#else + pollfd pfd={get_fd(), events, 0}; + int result=::poll(&pfd, 1, timeout); + if(result<=0) + return result; + return pfd.revents; +#endif +} + +}