#define SIMGRID_MSG_H
#include <simgrid/actor.h>
+#include <simgrid/barrier.h>
+#include <simgrid/engine.h>
#include <simgrid/forward.h>
#include <simgrid/host.h>
#include <simgrid/instr.h>
+#include <simgrid/mailbox.h>
#include <simgrid/plugins/live_migration.h>
#include <simgrid/storage.h>
#include <simgrid/vm.h>
#include <simgrid/zone.h>
-#include <xbt/base.h>
-#include <xbt/dict.h>
-#include <xbt/dynar.h>
+#include <xbt.h>
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
#ifdef __cplusplus
#include <map>
XBT_PUBLIC int MSG_process_get_PID(msg_process_t process);
XBT_PUBLIC int MSG_process_get_PPID(msg_process_t process);
+XBT_PUBLIC sg_actor_t MSG_process_from_PID(int pid);
XBT_PUBLIC const char* MSG_process_get_name(msg_process_t process);
XBT_PUBLIC sg_host_t MSG_process_get_host(msg_process_t process);
XBT_PUBLIC void MSG_process_resume(msg_process_t process);
XBT_PUBLIC int MSG_process_is_suspended(msg_process_t process);
XBT_PUBLIC void MSG_process_restart(msg_process_t process);
+XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
XBT_PUBLIC void MSG_process_daemonize(msg_process_t process);
XBT_PUBLIC void MSG_process_migrate(msg_process_t process, msg_host_t host);
-
-/* ******************************** File ************************************ */
-typedef sg_file_t msg_file_t;
-XBT_PUBLIC_DATA int sg_storage_max_file_descriptors;
+XBT_PUBLIC void MSG_process_join(msg_process_t process, double timeout);
+XBT_PUBLIC void MSG_process_kill(msg_process_t process);
+XBT_PUBLIC void MSG_process_killall();
+XBT_PUBLIC void MSG_process_set_kill_time(msg_process_t process, double kill_time);
+XBT_PUBLIC void MSG_process_yield();
/**
- * \brief @brief Communication action.
- * \ingroup msg_task_usage
+ * @brief @brief Communication action.
+ * @ingroup msg_task_usage
*
- * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
+ * Object representing an ongoing communication between processes. Such beast is usually obtained by using
+ * #MSG_task_isend, #MSG_task_irecv or friends.
*/
typedef sg_msg_Comm* msg_comm_t;
typedef struct msg_task* msg_task_t;
-/** \brief Default value for an uninitialized #msg_task_t.
- \ingroup m_task_management
+/** @brief Default value for an uninitialized #msg_task_t.
+ @ingroup m_task_management
*/
#define MSG_TASK_UNINITIALIZED NULL
/************************** Global ******************************************/
XBT_PUBLIC void MSG_config(const char* key, const char* value);
-/** \ingroup msg_simulation
- * \brief Initialize the MSG internal data.
- * \hideinitializer
+/** @ingroup msg_simulation
+ * @brief Initialize the MSG internal data.
+ * @hideinitializer
*
* It also check that the link-time and compile-time versions of SimGrid do
* match, so you should use this version instead of the #MSG_init_nocheck
*
* We allow to link against compiled versions that differ in the patch level.
*/
-#define MSG_init(argc,argv) do { \
- sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
- MSG_init_nocheck(argc,argv); \
+#define MSG_init(argc, argv) \
+ do { \
+ sg_version_check(SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH); \
+ MSG_init_nocheck(argc, argv); \
} while (0)
XBT_PUBLIC void MSG_init_nocheck(int* argc, char** argv);
XBT_PUBLIC msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties);
XBT_PUBLIC void MSG_process_detach();
-XBT_PUBLIC void MSG_process_kill(msg_process_t process);
-XBT_PUBLIC int MSG_process_killall();
-XBT_PUBLIC void MSG_process_yield();
-
XBT_PUBLIC void MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup);
-XBT_PUBLIC msg_process_t MSG_process_from_PID(int PID);
XBT_PUBLIC int MSG_process_self_PID();
XBT_PUBLIC int MSG_process_self_PPID();
XBT_PUBLIC const char* MSG_process_self_name();
XBT_PUBLIC xbt_dynar_t MSG_processes_as_dynar();
XBT_PUBLIC int MSG_process_get_number();
-XBT_PUBLIC msg_error_t MSG_process_set_kill_time(msg_process_t process, double kill_time);
-
XBT_PUBLIC void* MSG_process_get_data(msg_process_t process);
XBT_PUBLIC msg_error_t MSG_process_set_data(msg_process_t process, void* data);
XBT_PUBLIC void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void* data);
-XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
XBT_PUBLIC void MSG_process_ref(msg_process_t process);
XBT_PUBLIC void MSG_process_unref(msg_process_t process);
XBT_PUBLIC void MSG_task_set_priority(msg_task_t task, double priority);
XBT_PUBLIC void MSG_task_set_bound(msg_task_t task, double bound);
-XBT_PUBLIC msg_error_t MSG_process_join(msg_process_t process, double timeout);
XBT_PUBLIC msg_error_t MSG_process_sleep(double nb_sec);
XBT_PUBLIC void MSG_task_set_flops_amount(msg_task_t task, double flops_amount);
*/
XBT_PUBLIC void MSG_mailbox_set_async(const char* alias);
-/************************** Action handling **********************************/
-XBT_PUBLIC msg_error_t MSG_action_trace_run(char* path);
-XBT_PUBLIC void MSG_action_init();
-XBT_PUBLIC void MSG_action_exit();
-
/** @brief Opaque type representing a semaphore
* @ingroup msg_synchro
* @hideinitializer
XBT_PUBLIC void MSG_sem_destroy(msg_sem_t sem);
XBT_PUBLIC int MSG_sem_would_block(msg_sem_t sem);
-/** @brief Opaque type representing a barrier identifier
- * @ingroup msg_synchro
- * @hideinitializer
- */
-
-#define MSG_BARRIER_SERIAL_PROCESS -1
-typedef struct s_msg_bar_t* msg_bar_t;
+typedef sg_bar_t msg_bar_t;
XBT_PUBLIC msg_bar_t MSG_barrier_init(unsigned int count);
XBT_PUBLIC void MSG_barrier_destroy(msg_bar_t bar);
XBT_PUBLIC int MSG_barrier_wait(msg_bar_t bar);
/* ****************************************************************************************** */
-/* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
-XBT_PUBLIC smx_context_t MSG_process_get_smx_ctx(msg_process_t process);
+/* DO NOT USE this nasty pimple (unless if you're writing a binding) */
+XBT_PUBLIC smx_context_t
+XBT_ATTRIB_DEPRECATED_v323("MSG_process_get_smx_ctx is deprecated. Please contact us if you need it.")
+MSG_process_get_smx_ctx(msg_process_t process);
SG_END_DECL()
#ifdef __cplusplus
-XBT_PUBLIC msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data,
+XBT_PUBLIC msg_process_t MSG_process_create_from_stdfunc(std::string name, std::function<void()> code, void* data,
msg_host_t host,
- std::map<std::string, std::string>* properties);
+ std::unordered_map<std::string, std::string>* properties);
#endif
#endif