-
-/**
- * \brief Creates a new communicate synchro
- * \param type The direction of communication (comm_send, comm_recv)
- * \return The new communicate synchro
- */
-smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type)
-{
- simgrid::simix::Comm *comm = new simgrid::simix::Comm();
- comm->state = SIMIX_WAITING;
- comm->type = type;
- comm->refcount = 1;
- comm->src_data=NULL;
- comm->dst_data=NULL;
-
- XBT_DEBUG("Create communicate synchro %p", comm);
-
- return comm;
-}
-
-/**
- * \brief Destroy a communicate synchro
- * \param synchro The communicate synchro to be destroyed
- */
-void SIMIX_comm_destroy(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- XBT_DEBUG("Destroy synchro %p (refcount: %d), state: %d", comm, comm->refcount, (int)comm->state);
-
- if (comm->refcount <= 0) {
- xbt_backtrace_display_current();
- xbt_die("The refcount of comm %p is already 0 before decreasing it. "
- "That's a bug! If you didn't test and/or wait the same communication twice in your code, then the bug is SimGrid's...", synchro);
- }
- comm->refcount--;
- if (comm->refcount > 0)
- return;
- XBT_DEBUG("Really free communication %p; refcount is now %d", comm, comm->refcount);
-
- SIMIX_comm_destroy_internal_actions(synchro);
-
- if (comm->detached && comm->state != SIMIX_DONE) {
- /* the communication has failed and was detached:
- * we have to free the buffer */
- if (comm->clean_fun) {
- comm->clean_fun(comm->src_buff);
- }
- comm->src_buff = NULL;
- }
-
- if(comm->mbox)
- SIMIX_mbox_remove(comm->mbox, comm);
-
- delete comm;
-}
-
-void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
- if (comm->surf_comm){
- comm->surf_comm->unref();
- comm->surf_comm = NULL;
- }
-
- if (comm->src_timeout){
- comm->src_timeout->unref();
- comm->src_timeout = NULL;
- }
-
- if (comm->dst_timeout){
- comm->dst_timeout->unref();
- comm->dst_timeout = NULL;
- }
-}
-
-void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_mailbox_t mbox,
- double task_size, double rate,
- void *src_buff, size_t src_buff_size,
- int (*match_fun)(void *, void *,smx_synchro_t),
- void (*copy_data_fun)(smx_synchro_t, void*, size_t),
- void *data, double timeout){
- smx_synchro_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate,
- src_buff, src_buff_size, match_fun, NULL, copy_data_fun,
+XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox, double task_size,
+ double rate, void* src_buff, size_t src_buff_size,
+ int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+ double timeout)
+{
+ smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate,
+ src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,