Skip to content
Snippets Groups Projects
Commit 3b467421 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[ContextManager] Do not pre-allocate contexts

parent f751adac
No related branches found
No related tags found
1 merge request!338Add stack-usage stats
......@@ -13,22 +13,11 @@
#include "Emper.hpp"
#include "Fibril.hpp"
#include "Runtime.hpp"
#include "emper-common.h"
#include "emper-config.h" // // IWYU pragma: keep
class AbstractFiber;
ContextManager::ContextManager(Runtime& runtime) : MemoryManager(runtime), runtime(runtime) {
auto newWorkerHook = [this](ATTR_UNUSED workerid_t workerId) {
for (unsigned int i = 0; i < CONTEXT_MANAGER_FIRST_LAYER_QUEUE_SIZE * 2; ++i) {
auto* context = new Context(this->runtime.dispatcher.getDispatchLoop());
putFreeContext(context);
}
};
// Note that it is important that this hook is executed *after*
// the one of the MemoryManager superclass.
runtime.addNewWorkerHook(newWorkerHook);
}
ContextManager::ContextManager(Runtime& runtime) : MemoryManager(runtime), runtime(runtime) {}
auto ContextManager::getFreeContext() -> Context* {
if constexpr (!emper::CONTEXT_MANAGER_WITH_MEMORY_MANAGER) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment