-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2020. 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. */
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox, double task_size,
double rate, unsigned char* src_buff, size_t src_buff_size,
- int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double timeout)
{
XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(
smx_simcall_t /*simcall*/, smx_actor_t src_proc, smx_mailbox_t mbox, double task_size, double rate,
- unsigned char* src_buff, size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ unsigned char* src_buff, size_t src_buff_size,
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*clean_fun)(void*), // used to free the synchro in case of problem after a detached send
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), // used to copy data if not default one
void* data, bool detached)
XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox,
unsigned char* dst_buff, size_t* dst_buff_size,
- int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double timeout, double rate)
{
XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_irecv(
smx_simcall_t /*simcall*/, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size,
- simix_match_func_t match_fun, void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
- void* data, double rate)
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data, double rate)
{
simgrid::kernel::activity::CommImplPtr this_synchro =
simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl());
simgrid::kernel::activity::CommImplPtr other_comm;
// communication already done, get it inside the list of completed comms
if (mbox->permanent_receiver_ != nullptr && not mbox->done_comm_queue_.empty()) {
-
XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication");
// find a match in the list of already received comms
other_comm = mbox->find_matching_comm(simgrid::kernel::activity::CommImpl::Type::SEND, match_fun, data,
{
/* If both the sender and the receiver are already there, start the communication */
if (state_ == State::READY) {
-
s4u::Host* sender = src_actor_->get_host();
s4u::Host* receiver = dst_actor_->get_host();
simcall->issuer_->context_->iwannadie = true;
} else {
switch (state_) {
-
case State::DONE:
XBT_DEBUG("Communication %p complete!", this);
copy_data();