From 1e063a94dba49a1314cfbcdceb33fa6ed0dc3130 Mon Sep 17 00:00:00 2001 From: adfaure Date: Wed, 22 Jun 2016 16:57:47 +0200 Subject: [PATCH 1/1] [s4u] add this_actor::getPid() --- include/simgrid/s4u/actor.hpp | 5 +++++ src/s4u/s4u_actor.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/include/simgrid/s4u/actor.hpp b/include/simgrid/s4u/actor.hpp index 052ad862e5..9b38309464 100644 --- a/include/simgrid/s4u/actor.hpp +++ b/include/simgrid/s4u/actor.hpp @@ -277,6 +277,11 @@ namespace this_actor { * See \ref Comm for the full communication API (including non blocking communications). */ XBT_PUBLIC(void) send(Mailbox &chan, void*payload, size_t simulatedSize); + + /** + * Return the PID of the current actor. + */ + XBT_PUBLIC(int) getPid(); }; diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index ca6cfec3d0..1a97502d0e 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -122,6 +122,10 @@ void send(Mailbox &chan, void *payload, size_t simulatedSize) { c.wait(); } +int getPid() { + return simcall_process_get_PID(SIMIX_process_self()); +} + } } } -- 2.20.1