Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
Event.h
1#ifndef CSEMAPHORE_H
2#define CSEMAPHORE_H
3
4#include <QObject>
5
6#if defined(Q_OS_WIN)
7 #include <WinSock2.h>
8#else
9 #define SOCKET int
10#endif
11
12#include "channel_export.h"
13
14namespace Channel {
15
16class CHANNEL_EXPORT CEvent : public QObject
17{
18 Q_OBJECT
19public:
20 explicit CEvent(QObject *parent = nullptr);
21 virtual ~CEvent();
22
23 int Reset();
24 int WakeUp();
25
26 qintptr GetFd();
27
28 static int SetSocketNonBlocking(SOCKET fd);
29 static int SetSocketBlocking(SOCKET fd, bool block);
30 static bool EnableNagles(SOCKET fd, bool enable);
31
32 static QString GetAddress(void* address);
33
34private:
35 qintptr fd[2];
36
37 int Init();
38 int Clear();
39 int CreateSocketPair(qintptr fd[]);
40};
41
42} //namespace RabbitCommon
43
44#endif // CSEMAPHORE_H