XBT_PUBLIC void sg_actor_sleep_for(double duration);
XBT_PUBLIC sg_actor_t sg_actor_attach(const char* name, void* data, sg_host_t host, xbt_dict_t properties);
XBT_PUBLIC void sg_actor_detach();
+XBT_PUBLIC sg_actor_t sg_actor_self();
+XBT_PUBLIC aid_t sg_actor_self_get_pid();
+XBT_PUBLIC aid_t sg_actor_self_get_ppid();
+XBT_PUBLIC const char* sg_actor_self_get_name();
+
SG_END_DECL()
#endif /* INCLUDE_SIMGRID_ACTOR_H_ */
XBT_PUBLIC void MSG_process_yield();
/*** @brief Sleep for the specified number of seconds */
XBT_PUBLIC msg_error_t MSG_process_sleep(double nb_sec);
+XBT_PUBLIC msg_process_t MSG_process_self();
+XBT_PUBLIC aid_t MSG_process_self_PID();
+XBT_PUBLIC aid_t MSG_process_self_PPID();
+XBT_PUBLIC const char* MSG_process_self_name();
/** @brief Object representing an ongoing communication between processes.
*
XBT_PUBLIC void MSG_process_detach();
XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
-XBT_PUBLIC int MSG_process_self_PID();
-XBT_PUBLIC int MSG_process_self_PPID();
-XBT_PUBLIC const char* MSG_process_self_name();
-XBT_PUBLIC msg_process_t MSG_process_self();
XBT_PUBLIC xbt_dynar_t MSG_processes_as_dynar();
XBT_PUBLIC int MSG_process_get_number();
{
sg_actor_detach();
}
+aid_t MSG_process_self_PID()
+{
+ return sg_actor_self_get_pid();
+}
+
+/** @brief Return the PPID of the current process.
+ *
+ * This function returns the PID of the parent of the currently running #msg_process_t.
+ */
+aid_t MSG_process_self_PPID()
+{
+ return sg_actor_self_get_ppid();
+}
+
+/** @brief Return the name of the current process. */
+const char* MSG_process_self_name()
+{
+ return sg_actor_self_get_name();
+}
+/** @brief Return the current process.
+ *
+ * This function returns the currently running #msg_process_t.
+ */
+msg_process_t MSG_process_self()
+{
+ return sg_actor_self();
+}
/* ************************** NetZones *************************** */
sg_netzone_t MSG_zone_get_root()
return SIMIX_process_count();
}
-/** @brief Return the PID of the current process.
- *
- * This function returns the PID of the currently running #msg_process_t.
- */
-int MSG_process_self_PID()
-{
- smx_actor_t self = SIMIX_process_self();
- return self == nullptr ? 0 : self->get_pid();
-}
-
-/** @brief Return the PPID of the current process.
- *
- * This function returns the PID of the parent of the currently running #msg_process_t.
- */
-int MSG_process_self_PPID()
-{
- return MSG_process_get_PPID(MSG_process_self());
-}
-
-/** @brief Return the name of the current process. */
-const char* MSG_process_self_name()
-{
- return SIMIX_process_self_get_name();
-}
-
-/** @brief Return the current process.
- *
- * This function returns the currently running #msg_process_t.
- */
-msg_process_t MSG_process_self()
-{
- return SIMIX_process_self()->ciface();
-}
-
/** @brief Add a function to the list of "on_exit" functions for the current process.
* The on_exit functions are the functions executed when your process is killed.
* You should use them to free the data used by your process.
{
simgrid::kernel::actor::ActorImpl::detach();
}
+
+aid_t sg_actor_self_get_pid()
+{
+ return simgrid::s4u::this_actor::get_pid();
+}
+
+aid_t sg_actor_self_get_ppid()
+{
+ return simgrid::s4u::this_actor::get_ppid();
+}
+
+const char* sg_actor_self_get_name()
+{
+ return simgrid::s4u::this_actor::get_cname();
+}
+
+sg_actor_t sg_actor_self()
+{
+ return simgrid::s4u::Actor::self();
+}
/* 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. */
-#include "simgrid/msg.h"
+#include "simgrid/actor.h"
+#include "simgrid/simix.h"
#include "xbt/virtu.h"
int xbt_getpid()
{
- return MSG_process_self_PID();
+ smx_actor_t self = SIMIX_process_self();
+ return self == NULL ? 0 : sg_actor_self_get_pid();
}
const char *xbt_procname(void)
{
- return MSG_process_self_name();
+ return SIMIX_process_self_get_name();
}