1 /* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_KERNEL_CONTEXT_UNIX_CONTEXT_HPP
7 #define SIMGRID_KERNEL_CONTEXT_UNIX_CONTEXT_HPP
9 #include <ucontext.h> /* context relative declarations */
16 #include <simgrid/simix.hpp>
17 #include <xbt/parmap.hpp>
19 #include "src/internal_config.h"
20 #include "src/kernel/context/ContextSwapped.hpp"
22 namespace simgrid::kernel::context {
24 class UContext : public SwappedContext {
26 UContext(std::function<void()>&& code, actor::ActorImpl* actor, SwappedContextFactory* factory);
29 ucontext_t uc_{}; /* the ucontext that executes the code */
31 void swap_into_for_real(SwappedContext* to) override;
34 class UContextFactory : public SwappedContextFactory {
36 UContext* create_context(std::function<void()>&& code, actor::ActorImpl* actor) override;
38 } // namespace simgrid::kernel::context