std::string tracing_category_ = "";
/* FIXME: expose these elements in the API */
bool detached_ = false;
- int (*match_fun_)(void*, void*, kernel::activity::CommImpl*) = nullptr;
+ bool (*match_fun_)(void*, void*, kernel::activity::CommImpl*) = nullptr;
void (*clean_fun_)(void*) = nullptr;
void (*copy_data_function_)(kernel::activity::CommImpl*, void*, size_t) = nullptr;
/** Creates and start a data transmission to that mailbox */
CommPtr put_async(void* data, uint64_t simulated_size_in_bytes);
- smx_activity_t iprobe(int type, int (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data);
+ smx_activity_t iprobe(int type, bool (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data);
/** Blocking data transmission */
void put(void* payload, uint64_t simulated_size_in_bytes);
/** Blocking data transmission with timeout */
#ifdef __cplusplus
XBT_PUBLIC void simcall_comm_send(smx_actor_t sender, 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*),
+ 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_PUBLIC smx_activity_t simcall_comm_isend(smx_actor_t sender, 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*),
+ bool (*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, 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*),
+ 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_PUBLIC smx_activity_t simcall_comm_irecv(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*),
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double rate);
XBT_PUBLIC smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type,
- int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void* data);
/* FIXME: waitany is going to be a vararg function, and should take a timeout */
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());
#endif
void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
- int (*match_fun)(void*, void*, CommImpl*) = nullptr; /* Filter function used by the other side. It is used when
+ bool (*match_fun)(void*, void*, CommImpl*) = nullptr; /* Filter function used by the other side. It is used when
looking if a given communication matches my needs. For that, myself must match the
expectations of the other side, too. See */
void (*copy_data_fun)(CommImpl*, void*, size_t) = nullptr;
xbt_die("Comm %p not found in mailbox %s", comm.get(), this->get_cname());
}
-CommImplPtr MailboxImpl::iprobe(int type, int (*match_fun)(void*, void*, CommImpl*), void* data)
+CommImplPtr MailboxImpl::iprobe(int type, bool (*match_fun)(void*, void*, CommImpl*), void* data)
{
XBT_DEBUG("iprobe from %p %p", this, &comm_queue_);
* @param remove_matching whether or not to clean the found object from the queue
* @return The communication activity if found, nullptr otherwise
*/
-CommImplPtr MailboxImpl::find_matching_comm(CommImpl::Type type, int (*match_fun)(void*, void*, CommImpl*),
+CommImplPtr MailboxImpl::find_matching_comm(CommImpl::Type type, bool (*match_fun)(void*, void*, CommImpl*),
void* this_user_data, const CommImplPtr& my_synchro, bool done,
bool remove_matching)
{
void set_receiver(s4u::ActorPtr actor);
void push(CommImplPtr comm);
void remove(const CommImplPtr& comm);
- CommImplPtr iprobe(int type, int (*match_fun)(void*, void*, CommImpl*), void* data);
- CommImplPtr find_matching_comm(CommImpl::Type type, int (*match_fun)(void*, void*, CommImpl*), void* this_user_data,
+ CommImplPtr iprobe(int type, bool (*match_fun)(void*, void*, CommImpl*), void* data);
+ CommImplPtr find_matching_comm(CommImpl::Type type, bool (*match_fun)(void*, void*, CommImpl*), void* this_user_data,
const CommImplPtr& my_synchro, bool done, bool remove_matching);
actor::ActorImplPtr permanent_receiver_; // actor to which the mailbox is attached
return res;
}
-smx_activity_t Mailbox::iprobe(int type, int (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data)
+smx_activity_t Mailbox::iprobe(int type, bool (*match_fun)(void*, void*, kernel::activity::CommImpl*), void* data)
{
return kernel::actor::simcall([this, type, match_fun, data] { return pimpl_->iprobe(type, match_fun, data); });
}
* @ingroup simix_comm_management
*/
void simcall_comm_send(smx_actor_t sender, 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*),
+ size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
double timeout)
{
*/
smx_activity_t simcall_comm_isend(smx_actor_t sender, 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*),
+ bool (*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, bool detached)
* @ingroup simix_comm_management
*/
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*),
+ 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)
{
* @ingroup simix_comm_management
*/
smx_activity_t simcall_comm_irecv(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*),
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
void* data, double rate)
{
* @ingroup simix_comm_management
*/
smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type,
- int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data)
+ bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data)
{
xbt_assert(mbox, "No rendez-vous point defined for iprobe");
XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */
-typedef int (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
+typedef bool (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
typedef void (*simix_copy_data_func_t)(simgrid::kernel::activity::CommImpl*, void*, size_t);
typedef void (*simix_clean_func_t)(void*);
typedef void (*FPtr)(void); // Hide the ugliness
static int waitall(int count, MPI_Request requests[], MPI_Status status[]);
static int waitsome(int incount, MPI_Request requests[], int* indices, MPI_Status status[]);
- static int match_send(void* a, void* b, kernel::activity::CommImpl* ignored);
- static int match_recv(void* a, void* b, kernel::activity::CommImpl* ignored);
+ static bool match_send(void* a, void* b, kernel::activity::CommImpl* ignored);
+ static bool match_recv(void* a, void* b, kernel::activity::CommImpl* ignored);
static int grequest_start( MPI_Grequest_query_function *query_fn, MPI_Grequest_free_function *free_fn, MPI_Grequest_cancel_function *cancel_fn, void *extra_state, MPI_Request *request);
static int grequest_complete( MPI_Request request);
}
}
-int Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl*)
+bool Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl*)
{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
if(req->cancelled_==0)
req->cancelled_ = -1; // mark as uncancelable
XBT_DEBUG("match succeeded");
- return 1;
- }else return 0;
+ return true;
+ }
+ return false;
}
-int Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl*)
+bool Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl*)
{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
if(req->cancelled_==0)
req->cancelled_ = -1; // mark as uncancelable
XBT_DEBUG("match succeeded");
- return 1;
- } else
- return 0;
+ return true;
+ }
+ return false;
}
void Request::print_request(const char *message)