MCPcopy Create free account
hub / github.com/dobin/RedEdr / EventProcessorThread

Function EventProcessorThread

RedEdr/event_processor.cpp:265–292  ·  view source on GitHub ↗

Thread which retrieves and processes events from EventAggregator

Source from the content-addressed store, hash-verified

263
264// Thread which retrieves and processes events from EventAggregator
265DWORD WINAPI EventProcessorThread(LPVOID param) {
266 try {
267 size_t arrlen = 0;
268 std::unique_lock<std::mutex> lock(g_EventAggregator.analyzer_shutdown_mtx);
269
270 while (true) {
271 // Block for new events
272 g_EventAggregator.cv.wait(lock, [] { return g_EventAggregator.HasMoreEvents() || g_EventAggregator.done; });
273 if (g_EventAggregator.done) {
274 break;
275 }
276 // get em events
277 std::vector<std::string> new_entries = g_EventAggregator.GetEvents();
278
279 // process
280 g_EventProcessor.AnalyzeNewEvents(new_entries);
281 }
282 }
283 catch (const std::exception& e) {
284 LOG_A(LOG_ERROR, "EventProcessorThread: Exception in main loop: %s", e.what());
285 }
286 catch (...) {
287 LOG_A(LOG_ERROR, "EventProcessorThread: Unknown exception in main loop");
288 }
289
290 LOG_A(LOG_DEBUG, "!EventProcessor: Thread finished");
291 return 0;
292}
293
294
295int InitializeEventProcessor(std::vector<HANDLE>& threads) {

Callers

nothing calls this directly

Calls 5

HasMoreEventsMethod · 0.80
GetEventsMethod · 0.80
AnalyzeNewEventsMethod · 0.80
LOG_AFunction · 0.70
whatMethod · 0.45

Tested by

no test coverage detected