Skip to content

Prepare the IO subsystem for emper's future

Florian Fischer requested to merge aj46ezos/emper:terminate_io into master

All code related to the gloablIo is moved from IoContext to the GlobalIoContext child class.

Remember the runtime in each IoContext which created the IoContext. This allows the IoContexts to be independent from a global runtime reference. Because of this change a IoContext (global or worker) musst be retrieved from the a runtime object using Runtime::getIo()

The only point in the IO subsystem where we depend on Runtime::getRuntime() is when resubmitting a PartialCompletableFuture. To be sure we use the correct Runtime object Runtime::getRuntime() should return the runtime which started the thread (worker or globalCompleter). This could be achieved by remembering the runtime in a thread_local variable for example.

The global completer thread is now tied to a GlobalIoContext object and can be terminated using the GlobalIoContext's eventfd through GlobalIoContext::initiateTermination() and GlobalIoContext::waitUntilFinished()

Edited by Florian Fischer

Merge request reports