]> git.tdb.fi Git - libs/core.git/blob - source/core/pollable.cpp
Add a missing mutex unlock into Semaphore::wait
[libs/core.git] / source / core / pollable.cpp
1 /*
2 This file is part of libmspframework
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
5 */
6 #ifdef WIN32
7 #include <winsock2.h>
8 #include "win32poll.h"
9 #else
10 #include <poll.h>
11 #endif
12 #include "pollable.h"
13
14 namespace Msp {
15
16 short Pollable::poll(short events, int timeout)
17 {
18 #ifdef WIN32
19         return 0;
20 #else
21         pollfd pfd={get_fd(), events, 0};
22         int result=::poll(&pfd, 1, timeout);
23         if(result<=0)
24                 return result;
25         return pfd.revents;
26 #endif
27 }
28
29 }