Isle
Loading...
Searching...
No Matches
mxeventmanager.cpp
Go to the documentation of this file.
1#include "mxeventmanager.h"
2
3#include "mxcriticalsection.h"
4#include "mxmisc.h"
5#include "mxticklemanager.h"
6#include "mxticklethread.h"
7
8// FUNCTION: LEGO1 0x100c0360
10{
11 Init();
12}
13
14// FUNCTION: LEGO1 0x100c03f0
16{
18}
19
20// FUNCTION: LEGO1 0x100c0450
21void MxEventManager::Init()
22{
23 // This is intentionally left blank
24}
25
26// FUNCTION: LEGO1 0x100c0460
27void MxEventManager::Destroy(MxBool p_fromDestructor)
28{
29 if (m_thread != NULL) {
31 delete m_thread;
32 }
33 else {
35 }
36
37 if (!p_fromDestructor) {
39 }
40}
41
42// FUNCTION: LEGO1 0x100c04a0
43MxResult MxEventManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
44{
45 MxResult status = FAILURE;
46 MxBool locked = FALSE;
47
49 if (result == SUCCESS) {
50 if (p_createThread) {
52 locked = TRUE;
53 this->m_thread = new MxTickleThread(this, p_frequencyMS);
54
55 if (!this->m_thread || this->m_thread->Start(0, 0) != SUCCESS) {
56 goto done;
57 }
58 }
59 else {
60 TickleManager()->RegisterClient(this, p_frequencyMS);
61 }
62
63 status = SUCCESS;
64 }
65
66done:
67 if (status != SUCCESS) {
68 Destroy();
69 }
70
71 if (locked) {
73 }
74
75 return status;
76}
77
78// FUNCTION: LEGO1 0x100c0590
80{
82}
void Enter()
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available.
void Leave()
[AI] Releases/leaves the critical section or mutex.
MxEventManager()
Constructor for MxEventManager.
~MxEventManager() override
Destructor for MxEventManager.
void Destroy() override
Tears down the event manager and releases resources/thread/registration.
MxCriticalSection m_criticalSection
[AI] Critical section object used for guarding access to the presenter list and internal members for ...
MxThread * m_thread
[AI] Optional pointer to a worker thread used for media dispatch/IO (if multi-threaded operation is u...
virtual void Destroy()
[AI] Destroys all registered presenters and resets the internal state, ensuring safe resource disposa...
virtual MxResult Create()
[AI] Allocates and initializes the internal presenter list for this manager, ensuring thread safety.
void Terminate()
[AI] Signals the thread to terminate.
Definition: mxthread.cpp:50
MxResult Start(MxS32 p_stackSize, MxS32 p_flag)
[AI] Starts the thread with a given stack size and creation flags.
Definition: mxthread.cpp:28
virtual void UnregisterClient(MxCore *p_client)
[AI] Unregisters (marks for destruction) a previously registered client.
virtual void RegisterClient(MxCore *p_client, MxTime p_interval)
[AI] Registers an MxCore object to receive periodic tickles.
MxTickleThread periodically calls Tickle() on a target MxCore object in a separate thread.
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
MxTickleManager * TickleManager()
[AI] Provides access to the global tickle manager.
Definition: mxmisc.cpp:25
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned int MxU32
[AI]
Definition: mxtypes.h:32