Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change static fields in SwappedCtx into regular fields of the factory
[simgrid.git] / src / kernel / context / ContextRaw.hpp
index f1b7914..c30e4ec 100644 (file)
@@ -27,9 +27,8 @@ namespace context {
   */
 class RawContext : public SwappedContext {
 public:
-  RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
-  ~RawContext() override;
-  void stop() override;
+  RawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+             SwappedContextFactory* factory);
 
   void swap_into(SwappedContext* to) override;
 
@@ -47,35 +46,11 @@ private:
   static void wrapper(void* arg);
 };
 
-class ParallelRawContext : public RawContext {
+class RawContextFactory : public SwappedContextFactory {
 public:
-  ParallelRawContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
-      : RawContext(std::move(code), cleanup_func, process)
-  {
-  }
-  void suspend() override;
-  void resume() override;
+  RawContextFactory() : SwappedContextFactory("RawContextFactory") {}
 
-  static void initialize();
-  static void finalize();
-  static void run_all();
-
-private:
-  static simgrid::xbt::Parmap<smx_actor_t>* parmap_;
-  static std::vector<ParallelRawContext*> workers_context_;
-  static std::atomic<uintptr_t> threads_working_;
-  static uintptr_t thread_local worker_id_;
-};
-
-class RawContextFactory : public ContextFactory {
-public:
-  RawContextFactory();
-  ~RawContextFactory() override;
   Context* create_context(std::function<void()> code, void_pfn_smxprocess_t cleanup, smx_actor_t process) override;
-  void run_all() override;
-
-private:
-  bool parallel_;
 };
 }}} // namespace