Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / simix / SynchroComm.hpp
1 /* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef _SIMIX_SYNCHRO_COMM_HPP
7 #define _SIMIX_SYNCHRO_COMM_HPP
8
9 #include "src/simix/Synchro.h"
10
11 typedef enum {
12   SIMIX_COMM_SEND,
13   SIMIX_COMM_RECEIVE,
14   SIMIX_COMM_READY,
15   SIMIX_COMM_DONE
16 } e_smx_comm_type_t;
17
18 namespace simgrid {
19 namespace simix {
20
21   XBT_PUBLIC_CLASS Comm : public Synchro {
22   public:
23     e_smx_comm_type_t type;         /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
24     smx_mailbox_t mbox;             /* Rendez-vous where the comm is queued */
25
26 #if HAVE_MC
27     smx_mailbox_t mbox_cpy;         /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR
28                                        (comm.mbox set to NULL when the communication is removed from the mailbox
29                                        (used as garbage collector)) */
30 #endif
31     int refcount;                   /* Number of processes involved in the cond */
32     int detached;                   /* If detached or not */
33
34     void (*clean_fun)(void*);       /* Function to clean the detached src_buf if something goes wrong */
35     int (*match_fun)(void*,void*,smx_synchro_t);  /* Filter function used by the other side. It is used when
36                                        looking if a given communication matches my needs. For that, myself must match the
37                                        expectations of the other side, too. See  */
38     void (*copy_data_fun) (smx_synchro_t, void*, size_t);
39
40     /* Surf action data */
41     surf_action_t surf_comm;        /* The Surf communication action encapsulated */
42     surf_action_t src_timeout;      /* Surf's actions to instrument the timeouts */
43     surf_action_t dst_timeout;      /* Surf's actions to instrument the timeouts */
44     smx_process_t src_proc;
45     smx_process_t dst_proc;
46     double rate;
47     double task_size;
48
49     /* Data to be transfered */
50     void *src_buff;
51     void *dst_buff;
52     size_t src_buff_size;
53     size_t *dst_buff_size;
54     unsigned copied:1;              /* whether the data were already copied */
55
56     void* src_data;                 /* User data associated to communication */
57     void* dst_data;
58   };
59
60 }} // namespace simgrid::simix
61
62 #endif