1 /* Copyright (c) 2009-2018. 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_SIMIX_SWAPPED_CONTEXT_HPP
7 #define SIMGRID_SIMIX_SWAPPED_CONTEXT_HPP
15 class SwappedContext : public Context {
17 SwappedContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
18 : Context(std::move(code), cleanup_func, process)
21 virtual void suspend();
22 virtual void resume();
24 static void run_all();
26 virtual void swap_into(SwappedContext* to) = 0;
28 static SwappedContext* get_maestro() { return maestro_context_; }
29 static void set_maestro(SwappedContext* maestro) { maestro_context_ = maestro; }
32 static unsigned long process_index_;
33 static SwappedContext* maestro_context_;
36 } // namespace context
38 } // namespace simgrid