ezEngine  Release 25.03
ezMessageLoop Class Referenceabstract

Internal sub-system used by ezIpcChannel. More...

#include <MessageLoop.h>

Inheritance diagram for ezMessageLoop:

Public Member Functions

void AddChannel (ezIpcChannel *pChannel)
 Needs to be called by newly created channels' constructors.
 
void RemoveChannel (ezIpcChannel *pChannel)
 

Protected Member Functions

 EZ_MAKE_SUBSYSTEM_STARTUP_FRIEND (Foundation, MessageLoop)
 
void StartUpdateThread ()
 
void StopUpdateThread ()
 
void RunLoop ()
 
bool ProcessTasks ()
 
void Quit ()
 
virtual void WakeUp ()=0
 Wake up the message loop when new work comes in.
 
virtual bool WaitForMessages (ezInt32 iTimeout, ezIpcChannel *pFilter)=0
 Waits until a new message has been processed (sent, received). More...
 

Protected Attributes

ezThreadID m_ThreadId = 0
 
ezMutex m_Mutex
 
bool m_bShouldQuit = false
 
bool m_bCallTickFunction = false
 
class ezLoopThread * m_pUpdateThread = nullptr
 
ezMutex m_TasksMutex
 
ezDynamicArray< ezIpcChannel * > m_ConnectQueue
 
ezDynamicArray< ezIpcChannel * > m_DisconnectQueue
 
ezDynamicArray< ezIpcChannel * > m_SendQueue
 
ezDynamicArray< ezIpcChannel * > m_ConnectQueueTask
 
ezDynamicArray< ezIpcChannel * > m_DisconnectQueueTask
 
ezDynamicArray< ezIpcChannel * > m_SendQueueTask
 
ezDynamicArray< ezIpcChannel * > m_AllAddedChannels
 

Friends

class ezLoopThread
 
class ezIpcChannel
 

Detailed Description

Internal sub-system used by ezIpcChannel.

This sub-system creates a background thread as soon as the first ezIpcChannel is added to it. This class should never be needed to be accessed outside of ezIpcChannel implementations.

Member Function Documentation

◆ WaitForMessages()

virtual bool ezMessageLoop::WaitForMessages ( ezInt32  iTimeout,
ezIpcChannel pFilter 
)
protectedpure virtual

Waits until a new message has been processed (sent, received).

Parameters
timeoutIf negative, wait indefinitely.
pFilterIf not null, wait for a message for the specific channel.
Returns
Returns whether a message was received or the timeout was reached.

Implemented in ezMessageLoop_Fallback.


The documentation for this class was generated from the following files: