]> git.tdb.fi Git - libs/core.git/blob - source/pollable.cpp
Add files
[libs/core.git] / source / pollable.cpp
1 /*
2 This file is part of libmspframework
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
5 */
6 #include <poll.h>
7 #include "pollable.h"
8
9 namespace Msp {
10
11 short Pollable::poll(short events, int timeout)
12 {
13         pollfd pfd={get_fd(), events, 0};
14         int result=::poll(&pfd, 1, timeout);
15         if(result<=0)
16                 return result;
17         return pfd.revents;
18 }
19
20 }