Plasma Engine  2.0
Loading...
Searching...
No Matches
MessageLoop_Win.h
1#pragma once
2
3#include <Foundation/FoundationInternal.h>
4PL_FOUNDATION_INTERNAL_HEADER
5
6#if PL_ENABLED(PL_PLATFORM_WINDOWS_DESKTOP)
7
8# include <Foundation/Basics.h>
9# include <Foundation/Basics/Platform/Win/IncludeWindows.h>
10# include <Foundation/Communication/Implementation/MessageLoop.h>
11
12class plIpcChannel;
13struct IOContext;
14
15class PL_FOUNDATION_DLL plMessageLoop_win : public plMessageLoop
16{
17public:
18 struct IOItem
19 {
20 PL_DECLARE_POD_TYPE();
21
22 plIpcChannel* pChannel;
23 IOContext* pContext;
24 DWORD uiBytesTransfered;
25 DWORD uiError;
26 };
27
28public:
29 plMessageLoop_win();
30 ~plMessageLoop_win();
31
32 HANDLE GetPort() const { return m_hPort; }
33
34protected:
35 virtual void WakeUp() override;
36 virtual bool WaitForMessages(plInt32 iTimeout, plIpcChannel* pFilter) override;
37
38 bool GetIOItem(plInt32 iTimeout, IOItem* pItem);
39 bool ProcessInternalIOItem(const IOItem& item);
40 bool MatchCompletedIOItem(plIpcChannel* pFilter, IOItem* pItem);
41
42private:
43 plDynamicArray<IOItem> m_CompletedIO;
44 LONG m_iHaveWork = 0;
45 HANDLE m_hPort = INVALID_HANDLE_VALUE;
46};
47
48#endif
Definition DynamicArray.h:81
Base class for a communication channel between processes.
Definition IpcChannel.h:44
Internal sub-system used by plIpcChannel.
Definition MessageLoop.h:20
virtual bool WaitForMessages(plInt32 iTimeout, plIpcChannel *pFilter)=0
Waits until a new message has been processed (sent, received).
virtual void WakeUp()=0
Wake up the message loop when new work comes in.