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
Inline SIMIX_context_get_current()
[simgrid.git]
/
src
/
kernel
/
context
/
Context.cpp
diff --git
a/src/kernel/context/Context.cpp
b/src/kernel/context/Context.cpp
index
7104651
..
0aead0c
100644
(file)
--- a/
src/kernel/context/Context.cpp
+++ b/
src/kernel/context/Context.cpp
@@
-29,6
+29,7
@@
smx_context_t SIMIX_context_new(
namespace simgrid {
namespace kernel {
namespace context {
namespace simgrid {
namespace kernel {
namespace context {
+static thread_local smx_context_t smx_current_context;
ContextFactoryInitializer factory_initializer = nullptr;
ContextFactoryInitializer factory_initializer = nullptr;
@@
-36,15
+37,15
@@
ContextFactory::~ContextFactory() = default;
Context* ContextFactory::self()
{
Context* ContextFactory::self()
{
- return
SIMIX_context_get_current()
;
+ return
smx_current_context
;
}
}
-void Context
Factory::declare_context(void* context,
std::size_t size)
+void Context
::declare_context(
std::size_t size)
{
#if SIMGRID_HAVE_MC
/* Store the address of the stack in heap to compare it apart of heap comparison */
if(MC_is_active())
{
#if SIMGRID_HAVE_MC
/* Store the address of the stack in heap to compare it apart of heap comparison */
if(MC_is_active())
- MC_ignore_heap(
context
, size);
+ MC_ignore_heap(
this
, size);
#endif
}
#endif
}
@@
-104,3
+105,11
@@
smx_context_t SIMIX_context_self()
return nullptr;
}
return nullptr;
}
+/**
+ * @brief Sets the current context of this thread.
+ * @param context the context to set
+ */
+void SIMIX_context_set_current(smx_context_t context)
+{
+ simgrid::kernel::context::smx_current_context = context;
+}