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