Skip to content

Commit 2d08dd5

Browse files
committed
Rename async event processing methods in EventEmitter
Refactored method names in EventEmitter for clarity: Start, Stop, and IsRunning are now StartAsyncProcessing, StopAsyncProcessing, and IsAsyncProcessing. Updated documentation and usage to match new names.
1 parent 5b6fd6b commit 2d08dd5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/foundation/event_emitter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ EventEmitter::EventEmitter()
99
: running_(false), stop_requested_(false), next_listener_id_(1) {}
1010

1111
EventEmitter::~EventEmitter() {
12-
Stop();
12+
StopAsyncProcessing();
1313
}
1414

1515
size_t EventEmitter::AddListener(std::type_index event_type,
@@ -89,7 +89,7 @@ void EventEmitter::EmitAsync(std::unique_ptr<Event> event) {
8989

9090
// Start the worker thread if not already running
9191
if (!running_.load()) {
92-
Start();
92+
StartAsyncProcessing();
9393
}
9494

9595
{
@@ -100,7 +100,7 @@ void EventEmitter::EmitAsync(std::unique_ptr<Event> event) {
100100
queue_condition_.notify_one();
101101
}
102102

103-
void EventEmitter::Start() {
103+
void EventEmitter::StartAsyncProcessing() {
104104
if (running_.load()) {
105105
return; // Already running
106106
}
@@ -111,7 +111,7 @@ void EventEmitter::Start() {
111111
worker_thread_ = std::thread(&EventEmitter::ProcessAsyncEvents, this);
112112
}
113113

114-
void EventEmitter::Stop() {
114+
void EventEmitter::StopAsyncProcessing() {
115115
if (!running_.load()) {
116116
return; // Not running
117117
}
@@ -132,7 +132,7 @@ void EventEmitter::Stop() {
132132
}
133133
}
134134

135-
bool EventEmitter::IsRunning() const {
135+
bool EventEmitter::IsAsyncProcessing() const {
136136
return running_.load();
137137
}
138138

src/foundation/event_emitter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,17 @@ class EventEmitter {
141141
* Start the background thread for asynchronous event processing.
142142
* This is called automatically when needed, but can be called explicitly.
143143
*/
144-
void Start();
144+
void StartAsyncProcessing();
145145

146146
/**
147147
* Stop the background thread and clear the event queue.
148148
*/
149-
void Stop();
149+
void StopAsyncProcessing();
150150

151151
/**
152152
* Check if the background thread is running.
153153
*/
154-
bool IsRunning() const;
154+
bool IsAsyncProcessing() const;
155155

156156
/**
157157
* Emit an event synchronously to all registered listeners.
@@ -176,7 +176,7 @@ class EventEmitter {
176176
* Emit an event asynchronously.
177177
* The event will be dispatched on a background thread.
178178
*
179-
* @param event The event to emit (will be copied)
179+
* @param event The event to emit (will be moved)
180180
*/
181181
void EmitAsync(std::unique_ptr<Event> event);
182182

0 commit comments

Comments
 (0)