C++ riddle
This time small C++ riddle which took me some time to figure out :) Background: My editor currently use sockets connection to pass data between Qt UI and "Editor module" in engine. Inside editor module this happen on two threads: Processing events on editor module side Receive data and send result of events back to UI. Code of two main function execute on them can found bellow: Processing events (Show/hide) EError CAppEditor::processEditorEvents( void ) { if (!m_eventsToProcess) { return EErrors::Succeeded_NothingToDo; } SEvent * events = wrAtomic::exchange(&m_eventsToProcess, (SEvent*)nullptr); if (events != nullptr && events->next != nullptr) { SEvent * rEvents = nullptr; while(events != nullptr) { SEvent* tmp = events; events = events->next; tmp->next = rEvents; rEvents = tmp; } events = rEvents; } while(e...