X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f45abd9a448a9196144cb2aa845cb966b741d562..68789b70e7a97bf748e0829eceeb4e2aca2cc490:/src/kernel/context/ContextRaw.hpp diff --git a/src/kernel/context/ContextRaw.hpp b/src/kernel/context/ContextRaw.hpp index f1b7914011..b966a153f9 100644 --- a/src/kernel/context/ContextRaw.hpp +++ b/src/kernel/context/ContextRaw.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -27,9 +27,8 @@ namespace context { */ class RawContext : public SwappedContext { public: - RawContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process); - ~RawContext() override; - void stop() override; + RawContext(std::function 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 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* parmap_; - static std::vector workers_context_; - static std::atomic threads_working_; - static uintptr_t thread_local worker_id_; -}; - -class RawContextFactory : public ContextFactory { -public: - RawContextFactory(); - ~RawContextFactory() override; Context* create_context(std::function code, void_pfn_smxprocess_t cleanup, smx_actor_t process) override; - void run_all() override; - -private: - bool parallel_; }; }}} // namespace