#include <csignal>
#include <functional>
-namespace simgrid {
-namespace kernel {
-namespace context {
+namespace simgrid::kernel::context {
extern unsigned stack_size;
extern unsigned guard_size;
/** 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)
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);
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_); }
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();
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