Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 's4u_enforce' into 'master'
[simgrid.git] / src / kernel / context / Context.hpp
index 473af7a0c550306b14b3c2bea42b336853c0d320..c8aba566f3b4e0d64a62f3e0b00bec19f97b5d2e 100644 (file)
@@ -14,9 +14,7 @@
 #include <csignal>
 #include <functional>
 
-namespace simgrid {
-namespace kernel {
-namespace context {
+namespace simgrid::kernel::context {
 extern unsigned stack_size;
 extern unsigned guard_size;
 
@@ -33,7 +31,10 @@ public:
   /** Turn the current thread into maestro (the old maestro becomes a regular actor) */
   virtual Context* create_maestro(std::function<void()>&& code, actor::ActorImpl* actor);
 
-  virtual void run_all() = 0;
+  virtual void run_all(std::vector<actor::ActorImpl*> const& actors_list) = 0;
+
+  /* This allows Java to hijack the context factory (Java induces factories of factory :) */
+  static std::function<ContextFactory*(void)> initializer;
 
 protected:
   template <class T, class... Args> T* new_context(Args&&... args)
@@ -51,8 +52,6 @@ class XBT_PUBLIC Context {
 
   std::function<void()> code_;
   actor::ActorImpl* actor_ = nullptr;
-  bool iwannadie_          = false; // True if we need to do some cleanups in actor mode.
-  bool to_be_freed_        = false; // True if cleanups in actor mode done, but cleanups in kernel mode pending
   bool is_maestro_;
   void declare_context(std::size_t size);
 
@@ -66,10 +65,6 @@ public:
   Context& operator=(const Context&) = delete;
   virtual ~Context();
 
-  bool wannadie() const { return iwannadie_; }
-  void set_wannadie(bool value = true);
-  bool to_be_freed() const { return to_be_freed_; }
-  void set_to_be_freed() { to_be_freed_ = true; }
   bool is_maestro() const { return is_maestro_; }
   void operator()() const { code_(); }
   bool has_code() const { return static_cast<bool>(code_); }
@@ -103,11 +98,6 @@ public:
   virtual void attach_stop() = 0;
 };
 
-
-/* This allows Java to hijack the context factory (Java induces factories of factory :) */
-using ContextFactoryInitializer = ContextFactory* (*)();
-XBT_PUBLIC_DATA ContextFactoryInitializer factory_initializer;
-
 XBT_PRIVATE ContextFactory* thread_factory();
 XBT_PRIVATE ContextFactory* sysv_factory();
 XBT_PRIVATE ContextFactory* raw_factory();
@@ -118,8 +108,6 @@ XBT_PUBLIC int get_nthreads();
 XBT_PUBLIC void set_nthreads(int nb_threads);
 XBT_PUBLIC void set_parallel_mode(e_xbt_parmap_mode_t mode);
 XBT_PUBLIC e_xbt_parmap_mode_t get_parallel_mode();
-} // namespace context
-} // namespace kernel
-} // namespace simgrid
+} // namespace simgrid::kernel::context
 
 #endif