Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove features marked with XBT_ATTRIB_DEPRECATED_v325.
[simgrid.git] / src / msg / msg_legacy.cpp
index eb797db..344a8f9 100644 (file)
@@ -1,8 +1,9 @@
-/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved.          */
 
 /* 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/Exception.hpp"
 #include "src/msg/msg_private.hpp"
 
 #define MSG_CALL(type, oldname, args)
 /* ************************** Engine *************************** */
 void MSG_create_environment(const char* filename)
 {
-  sg_engine_load_platform(filename);
+  simgrid_load_platform(filename);
 }
 
 void MSG_launch_application(const char* filename)
 {
-  sg_engine_load_deployment(filename);
+  simgrid_load_deployment(filename);
+}
+msg_error_t MSG_main()
+{
+  simgrid_run();
+  return MSG_OK;
 }
 void MSG_function_register(const char* name, xbt_main_func_t code)
 {
-  sg_engine_register_function(name, code);
+  simgrid_register_function(name, code);
 }
 void MSG_function_register_default(xbt_main_func_t code)
 {
-  sg_engine_register_default(code);
+  simgrid_register_default(code);
 }
 double MSG_get_clock()
 {
-  return sg_engine_get_clock();
+  return simgrid_get_clock();
+}
+
+/* ************************** Mailboxes ************************ */
+void MSG_mailbox_set_async(const char* alias)
+{
+  sg_mailbox_set_receiver(alias);
+}
+int MSG_task_listen(const char* alias)
+{
+  return sg_mailbox_listen(alias);
 }
+
 /* ************************** Actors *************************** */
 int MSG_process_get_PID(sg_actor_t actor)
 {
@@ -74,6 +91,11 @@ void MSG_process_restart(sg_actor_t actor)
 {
   sg_actor_restart(actor);
 }
+void MSG_process_auto_restart_set(sg_actor_t actor, int auto_restart)
+{
+  sg_actor_set_auto_restart(actor, auto_restart);
+}
+
 void MSG_process_daemonize(sg_actor_t actor)
 {
   sg_actor_daemonize(actor);
@@ -103,6 +125,64 @@ void MSG_process_yield()
   sg_actor_yield();
 }
 
+msg_error_t MSG_process_sleep(double duration)
+{
+  try {
+    sg_actor_sleep_for(duration);
+    return MSG_OK;
+  } catch (const simgrid::HostFailureException&) {
+    return MSG_HOST_FAILURE;
+  }
+}
+
+msg_process_t MSG_process_attach(const char* name, void* data, msg_host_t host, xbt_dict_t properties)
+{
+  return sg_actor_attach(name, data, host, properties);
+}
+
+void MSG_process_detach()
+{
+  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();
+}
+
+/** @brief Take an extra reference on that process to prevent it to be garbage-collected */
+void MSG_process_ref(msg_process_t process)
+{
+  sg_actor_ref(process);
+}
+/** @brief Release a reference on that process so that it can get be garbage-collected */
+void MSG_process_unref(msg_process_t process)
+{
+  sg_actor_unref(process);
+}
+
 /* ************************** NetZones *************************** */
 sg_netzone_t MSG_zone_get_root()
 {
@@ -202,11 +282,11 @@ const char* MSG_host_get_name(sg_host_t host)
 }
 void* MSG_host_get_data(sg_host_t host)
 {
-  return sg_host_user(host);
+  return sg_host_data(host);
 }
 void MSG_host_set_data(sg_host_t host, void* data)
 {
-  return sg_host_user_set(host, data);
+  return sg_host_data_set(host, data);
 }
 xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host)
 {
@@ -252,10 +332,6 @@ int MSG_host_is_on(sg_host_t h)
 {
   return sg_host_is_on(h);
 }
-int MSG_host_is_off(sg_host_t h)
-{
-  return sg_host_is_off(h);
-}
 xbt_dict_t MSG_host_get_properties(sg_host_t host)
 {
   return sg_host_get_properties(host);
@@ -276,6 +352,11 @@ sg_host_t MSG_host_self()
 {
   return sg_host_self();
 }
+
+double MSG_host_get_load(sg_host_t host)
+{
+  return sg_host_load(host);
+}
 /* ************************** Virtual Machines *************************** */
 sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name)
 {
@@ -337,3 +418,47 @@ void MSG_vm_destroy(sg_vm_t vm)
 {
   sg_vm_destroy(vm);
 }
+/********* barriers ************/
+sg_bar_t MSG_barrier_init(unsigned int count)
+{
+  return sg_barrier_init(count);
+}
+
+void MSG_barrier_destroy(sg_bar_t bar)
+{
+  sg_barrier_destroy(bar);
+}
+
+int MSG_barrier_wait(sg_bar_t bar)
+{
+  return sg_barrier_wait(bar);
+}
+
+sg_sem_t MSG_sem_init(int initial_value)
+{
+  return sg_sem_init(initial_value);
+}
+void MSG_sem_acquire(sg_sem_t sem)
+{
+  sg_sem_acquire(sem);
+}
+int MSG_sem_acquire_timeout(sg_sem_t sem, double timeout)
+{
+  return sg_sem_acquire_timeout(sem, timeout);
+}
+void MSG_sem_release(sg_sem_t sem)
+{
+  sg_sem_release(sem);
+}
+int MSG_sem_get_capacity(sg_sem_t sem)
+{
+  return sg_sem_get_capacity(sem);
+}
+void MSG_sem_destroy(sg_sem_t sem)
+{
+  sg_sem_destroy(sem);
+}
+int MSG_sem_would_block(sg_sem_t sem)
+{
+  return sg_sem_would_block(sem);
+}