Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simcall_comm_test returns a bool too
[simgrid.git] / include / simgrid / simix.h
index 7fcf130..99de58b 100644 (file)
@@ -129,12 +129,13 @@ XBT_PUBLIC void SIMIX_launch_application(const std::string& file);
  */
 
 #ifdef __cplusplus
-XBT_PUBLIC smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostname,
-                                            std::unordered_map<std::string, std::string>* properties,
-                                            smx_actor_t parent_process);
+XBT_ATTRIB_DEPRECATED_v325("Please use ActorImpl::attach() or sg_actor_attach()") XBT_PUBLIC smx_actor_t
+    SIMIX_process_attach(const char* name, void* data, const char* hostname,
+                         std::unordered_map<std::string, std::string>* properties, smx_actor_t parent_process);
 #endif
 SG_BEGIN_DECL()
-XBT_PUBLIC void SIMIX_process_detach();
+XBT_ATTRIB_DEPRECATED_v325("Please use ActorImpl::detach() or sg_actor_detach()") XBT_PUBLIC
+    void SIMIX_process_detach();
 SG_END_DECL()
 
 /********************************* Process ************************************/
@@ -142,14 +143,19 @@ SG_BEGIN_DECL()
 XBT_PUBLIC int SIMIX_process_count();
 XBT_PUBLIC smx_actor_t SIMIX_process_self();
 XBT_PUBLIC const char* SIMIX_process_self_get_name();
-XBT_PUBLIC void SIMIX_process_self_set_data(void* data);
-XBT_PUBLIC void* SIMIX_process_self_get_data();
-XBT_PUBLIC int SIMIX_process_has_pending_comms(smx_actor_t process);
-XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data);
+XBT_ATTRIB_DEPRECATED_v325("Please use ActorImpl::set_user_data()") XBT_PUBLIC
+    void SIMIX_process_self_set_data(void* data);
+XBT_ATTRIB_DEPRECATED_v325("Please use ActorImpl::get_user_data()") XBT_PUBLIC void* SIMIX_process_self_get_data();
+XBT_ATTRIB_DEPRECATED_v325("Please manifest if you actually need this function") XBT_PUBLIC
+    int SIMIX_process_has_pending_comms(smx_actor_t process);
+XBT_ATTRIB_DEPRECATED_v325("Please use SIMIX_process_on_exit(smx_actor_t, const std::function<void(bool)>&)") XBT_PUBLIC
+    void SIMIX_process_on_exit(smx_actor_t process, int_f_pvoid_pvoid_t fun, void* data);
 SG_END_DECL()
 
 #ifdef __cplusplus
-XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, std::function<void(int, void*)> fun, void* data);
+XBT_ATTRIB_DEPRECATED_v325("Please use SIMIX_process_on_exit(smx_actor_t, const std::function<void(bool)>&)") XBT_PUBLIC
+    void SIMIX_process_on_exit(smx_actor_t process, const std::function<void(int, void*)>& fun, void* data);
+XBT_PUBLIC void SIMIX_process_on_exit(smx_actor_t process, const std::function<void(bool /*failed*/)>& fun);
 #endif
 
 /****************************** Communication *********************************/
@@ -162,7 +168,7 @@ XBT_PUBLIC void SIMIX_comm_copy_buffer_callback(simgrid::kernel::activity::CommI
                                                 size_t buff_size);
 #endif
 
-XBT_ATTRIB_DEPRECATED_v325("Please use CommImpl::finish") XBT_PUBLIC void SIMIX_comm_finish(smx_activity_t synchro);
+XBT_ATTRIB_DEPRECATED_v325("Please use CommImpl::finish()") XBT_PUBLIC void SIMIX_comm_finish(smx_activity_t synchro);
 
 /******************************************************************************/
 /*                            SIMIX simcalls                                  */
@@ -173,12 +179,9 @@ XBT_ATTRIB_DEPRECATED_v325("Please use CommImpl::finish") XBT_PUBLIC void SIMIX_
 
 /******************************* Host simcalls ********************************/
 #ifdef __cplusplus
-XBT_PUBLIC smx_activity_t simcall_execution_parallel_start(const std::string& name, int host_nb,
-                                                           const sg_host_t* host_list, const double* flops_amount,
-                                                           const double* bytes_amount, double rate, double timeout);
+XBT_PUBLIC e_smx_state_t simcall_execution_wait(const smx_activity_t& execution);
+XBT_PUBLIC bool simcall_execution_test(const smx_activity_t& execution);
 #endif
-XBT_PUBLIC e_smx_state_t simcall_execution_wait(smx_activity_t execution);
-XBT_PUBLIC e_smx_state_t simcall_execution_test(smx_activity_t execution);
 
 /**************************** Process simcalls ********************************/
 SG_BEGIN_DECL()
@@ -208,7 +211,7 @@ XBT_PUBLIC smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t m
                                              int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                                              void (*clean_fun)(void*),
                                              void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
-                                             void* data, int detached);
+                                             void* data, bool detached);
 
 XBT_PUBLIC void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
                                   int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
@@ -224,19 +227,20 @@ XBT_PUBLIC smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t
 XBT_PUBLIC smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type,
                                               int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                                               void* data);
-#endif
 
 /* FIXME: waitany is going to be a vararg function, and should take a timeout */
-XBT_PUBLIC unsigned int simcall_comm_waitany(smx_activity_t* comms, size_t count, double timeout);
-XBT_PUBLIC void simcall_comm_wait(smx_activity_t comm, double timeout);
-XBT_PUBLIC int simcall_comm_test(smx_activity_t comm);
-XBT_PUBLIC int simcall_comm_testany(smx_activity_t* comms, size_t count);
+XBT_PUBLIC unsigned int simcall_comm_waitany(smx_activity_t comms[], size_t count, double timeout);
+XBT_PUBLIC unsigned int simcall_comm_waitany(simgrid::kernel::activity::CommImpl* comms[], size_t count,
+                                             double timeout);
+XBT_PUBLIC void simcall_comm_wait(const smx_activity_t& comm, double timeout);
+XBT_PUBLIC bool simcall_comm_test(const smx_activity_t& comm);
+XBT_PUBLIC int simcall_comm_testany(smx_activity_t comms[], size_t count);
+XBT_PUBLIC int simcall_comm_testany(simgrid::kernel::activity::CommImpl* comms[], size_t count);
+#endif
 
 /************************** Synchro simcalls **********************************/
 SG_BEGIN_DECL()
 XBT_PUBLIC smx_mutex_t simcall_mutex_init();
-XBT_PUBLIC smx_mutex_t SIMIX_mutex_ref(smx_mutex_t mutex);
-XBT_PUBLIC void SIMIX_mutex_unref(smx_mutex_t mutex);
 XBT_PUBLIC void simcall_mutex_lock(smx_mutex_t mutex);
 XBT_PUBLIC int simcall_mutex_trylock(smx_mutex_t mutex);
 XBT_PUBLIC void simcall_mutex_unlock(smx_mutex_t mutex);
@@ -277,6 +281,11 @@ SG_END_DECL()
 XBT_ATTRIB_DEPRECATED_v325("Please use Exec::start()") XBT_PUBLIC smx_activity_t
     simcall_execution_start(const std::string& name, const std::string& category, double flops_amount, double priority,
                             double bound, sg_host_t host);
+
+// Should be deprecated in v325 too but is still used in other deprecated calls
+XBT_PUBLIC smx_activity_t simcall_execution_parallel_start(const std::string& name, int host_nb,
+                                                           const sg_host_t* host_list, const double* flops_amount,
+                                                           const double* bytes_amount, double rate, double timeout);
 #endif
 
 #endif