Thread which retrieves and processes events from EventAggregator
| 263 | |
| 264 | // Thread which retrieves and processes events from EventAggregator |
| 265 | DWORD 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 | |
| 295 | int InitializeEventProcessor(std::vector<HANDLE>& threads) { |
nothing calls this directly
no test coverage detected