/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Platform/Linux/MessageLoop_Platform.h
67 строк
1 KB
Jan Krassnigg
Further refactor of platform specific code (2) (#1416)
25 окт 2024, 17:01
Не верифицирован
25 окт 2024, 17:01
b3eeda7
Код
Авторство
О чём код?
#pragma once #include <Foundation/FoundationInternal.h> EZ_FOUNDATION_INTERNAL_HEADER #if EZ_ENABLED(EZ_PLATFORM_LINUX) # include <Foundation/Basics.h> # include <Foundation/Communication/Implementation/MessageLoop.h> # include <Foundation/Threading/Mutex.h> # include <poll.h> class ezIpcChannel; class ezPipeChannel_linux; # ifndef _EZ_DEFINED_POLLFD_POD # define _EZ_DEFINED_POLLFD_POD EZ_DEFINE_AS_POD_TYPE(struct pollfd); # endif class EZ_FOUNDATION_DLL ezMessageLoop_linux : public ezMessageLoop { public: ezMessageLoop_linux(); ~ezMessageLoop_linux(); protected: virtual void WakeUp() override; virtual bool WaitForMessages(ezInt32 iTimeout, ezIpcChannel* pFilter) override; private: friend class ezPipeChannel_linux; enum class WaitType { Accept, IncomingMessage, Connect, Send }; void RegisterWait(ezPipeChannel_linux* pChannel, WaitType type, int fd); void RemovePendingWaits(ezPipeChannel_linux* pChannel); private: struct WaitInfo { EZ_DECLARE_POD_TYPE(); ezPipeChannel_linux* m_pChannel; WaitType m_type; }; // m_waitInfos and m_pollInfos are alway the same size. // related information is stored at the same index. ezHybridArray<WaitInfo, 16> m_waitInfos; ezHybridArray<struct pollfd, 16> m_pollInfos; ezMutex m_pollMutex; ezAtomicInteger32 m_numPendingPollModifications = 0; int m_wakeupPipeReadEndFd = -1; int m_wakeupPipeWriteEndFd = -1; }; using ezMessageLoop_Platform = ezMessageLoop_linux; #endif