1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef _SIMIX_SYNCHRO_COMM_HPP
7 #define _SIMIX_SYNCHRO_COMM_HPP
10 #include "src/simix/Synchro.h"
22 XBT_PUBLIC_CLASS Comm : public Synchro {
24 Comm(e_smx_comm_type_t type);
30 e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
31 smx_mailbox_t mbox = nullptr; /* Rendez-vous where the comm is queued */
34 smx_mailbox_t mbox_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR
35 (comm.mbox set to NULL when the communication is removed from the mailbox
36 (used as garbage collector)) */
38 int refcount = 1; /* Number of processes involved in the cond */
39 int detached = 0; /* If detached or not */
41 void (*clean_fun)(void*); /* Function to clean the detached src_buf if something goes wrong */
42 int (*match_fun)(void*,void*,smx_synchro_t); /* Filter function used by the other side. It is used when
43 looking if a given communication matches my needs. For that, myself must match the
44 expectations of the other side, too. See */
45 void (*copy_data_fun) (smx_synchro_t, void*, size_t);
47 /* Surf action data */
48 surf_action_t surf_comm = nullptr; /* The Surf communication action encapsulated */
49 surf_action_t src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
50 surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
51 smx_process_t src_proc = nullptr;
52 smx_process_t dst_proc = nullptr;
56 /* Data to be transfered */
57 void *src_buff = nullptr;
58 void *dst_buff = nullptr;
60 size_t *dst_buff_size;
61 unsigned copied = 0; /* whether the data were already copied */
63 void* src_data; /* User data associated to communication */
67 }} // namespace simgrid::simix