A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[doc] Add todo about user .then()
[simgrid.git]
/
src
/
simix
/
ContextRaw.cpp
diff --git
a/src/simix/ContextRaw.cpp
b/src/simix/ContextRaw.cpp
index
88d05bf
..
a11741f
100644
(file)
--- a/
src/simix/ContextRaw.cpp
+++ b/
src/simix/ContextRaw.cpp
@@
-4,13
+4,6
@@
/* 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. */
/* 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. */
-/** \file RawContext.cpp
- * Fast context switching inspired from SystemV ucontexts.
- *
- * In contrast to System V context, it does not touch the signal mask
- * which avoids making a system call (at least on Linux).
- */
-
#include <math.h>
#include <utility>
#include <math.h>
#include <utility>
@@
-35,6
+28,11
@@
namespace simix {
class RawContext;
class RawContextFactory;
class RawContext;
class RawContextFactory;
+/** @brief Fast context switching inspired from SystemV ucontexts.
+ *
+ * The main difference to the System V context is that Raw Contexts are much faster because they don't
+ * preserve the signal mask when switching. This saves a system call (at least on Linux) on each context switch.
+ */
class RawContext : public Context {
protected:
void* stack_ = nullptr;
class RawContext : public Context {
protected:
void* stack_ = nullptr;
@@
-45,7
+43,7
@@
public:
RawContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_process_t process);
RawContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func,
smx_process_t process);
- ~RawContext();
+ ~RawContext()
override
;
public:
static void wrapper(void* arg);
void stop() override;
public:
static void wrapper(void* arg);
void stop() override;
@@
-61,9
+59,9
@@
private:
class RawContextFactory : public ContextFactory {
public:
RawContextFactory();
class RawContextFactory : public ContextFactory {
public:
RawContextFactory();
- ~RawContextFactory();
+ ~RawContextFactory()
override
;
RawContext* create_context(std::function<void()> code,
RawContext* create_context(std::function<void()> code,
- void_pfn_smxprocess_t, smx_process_t process) override;
+ void_pfn_smxprocess_t
cleanup
, smx_process_t process) override;
void run_all() override;
private:
void run_all_adaptative();
void run_all() override;
private:
void run_all_adaptative();
@@
-408,7
+406,7
@@
void RawContext::suspend_parallel()
smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap);
RawContext* next_context = nullptr;
smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap);
RawContext* next_context = nullptr;
- if (next_work !=
NULL
) {
+ if (next_work !=
nullptr
) {
/* there is a next process to resume */
XBT_DEBUG("Run next process");
next_context = (RawContext*) next_work->context;
/* there is a next process to resume */
XBT_DEBUG("Run next process");
next_context = (RawContext*) next_work->context;