Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
New functions: s4u::Actor::property() and s4u::Actor::setProperty()
[simgrid.git] / src / s4u / s4u_actor.cpp
index de5b546..4841225 100644 (file)
@@ -151,6 +151,18 @@ void Actor::killAll(int resetPid)
   simcall_process_killall(resetPid);
 }
 
+/** Retrieve the property value (or nullptr if not set) */
+const char* Actor::property(const char* key)
+{
+  return (char*)xbt_dict_get_or_null(simcall_process_get_properties(pimpl_), key);
+}
+void Actor::setProperty(const char* key, const char* value)
+{
+  simgrid::simix::kernelImmediate([this, key, value] {
+    xbt_dict_set(simcall_process_get_properties(pimpl_), key, (char*)value, (void_f_pvoid_t) nullptr);
+  });
+}
+
 // ***** this_actor *****
 
 namespace this_actor {