1 /* Copyright (c) 2009-2019. 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"
26 class UContext : public SwappedContext {
28 UContext(std::function<void()>&& code, actor::ActorImpl* actor, SwappedContextFactory* factory);
30 void swap_into(SwappedContext* to) override;
33 ucontext_t uc_; /* the ucontext that executes the code */
36 class UContextFactory : public SwappedContextFactory {
38 UContext* create_context(std::function<void()>&& code, actor::ActorImpl* actor) override;
40 } // namespace context
42 } // namespace simgrid