Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Hello xbt/synchro module (synchronization working both in simulation and real life...
[simgrid.git] / src / include / simix / datatypes.h
1 /*      $Id$     */
2
3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
4    All rights reserved.                                          */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef SIMIX_DATATYPE_H
10 #define SIMIX_DATATYPE_H
11 #include "xbt/misc.h"
12 #include "xbt/swag.h"
13 #include "xbt/fifo.h"
14
15 SG_BEGIN_DECL()
16
17 /* ******************************** Host ************************************ */
18 /** @defgroup m_datatypes_management_details Details on SIMIX datatypes
19     @ingroup  m_datatypes_management*/
20
21 typedef struct s_smx_simdata_host *smx_simdata_host_t;
22 /** @brief Host datatype 
23     @ingroup m_datatypes_management_details */
24 typedef struct s_smx_host {
25   char *name;                   /**< @brief host name if any */
26   smx_simdata_host_t simdata;   /**< @brief simulator data */
27   void *data;                   /**< @brief user data */
28 } s_smx_host_t;
29 /** @brief Host datatype  
30     @ingroup m_datatypes_management
31
32     A <em>location</em> (or <em>host</em>) is any possible place where
33     a process may run. Thus it is represented as a <em>physical
34     resource with computing capabilities</em>, some <em>mailboxes</em>
35     to enable running process to communicate with remote ones, and
36     some <em>private data</em> that can be only accessed by local
37     process.
38
39     \see m_host_management
40   @{ */
41 typedef struct s_smx_host *smx_host_t;
42 /** @} */
43
44
45 /* ******************************** Syncro ************************************ */
46
47 typedef struct s_smx_mutex *smx_mutex_t;
48 typedef struct s_smx_cond *smx_cond_t;
49
50
51 /********************************** Action *************************************/
52 typedef struct s_smx_simdata_action *smx_simdata_action_t;
53 /** @brief Action datatype 
54     @ingroup m_datatypes_management_details */
55 typedef struct s_smx_action {
56   char *name;                   /**< @brief action name if any */
57   smx_simdata_action_t simdata; /**< @brief simulator data */
58         xbt_fifo_t cond_list;   /*< conditional variables that must be signaled when the action finish. */
59
60   void *data;                   /**< @brief user data */
61 } s_smx_action_t;
62
63 typedef struct s_smx_action *smx_action_t;
64
65
66 /* ****************************** Process *********************************** */
67 typedef struct s_smx_simdata_process *smx_simdata_process_t;
68 /** @brief Process datatype 
69     @ingroup m_datatypes_management_details @{ */
70 typedef struct s_smx_process {
71
72    /* KEEP IT IN SYNC WITH s_xbt_thread_ from src/xbt_sg_thread.h */
73    char *name;                  /**< @brief process name if any */
74    smx_simdata_process_t simdata;       /**< @brief simulator data */
75    s_xbt_swag_hookup_t process_hookup;
76    s_xbt_swag_hookup_t synchro_hookup;
77    s_xbt_swag_hookup_t host_proc_hookup;
78    void *data;                  /**< @brief user data */
79    /* KEEP IT IN SYNC WITH s_smx_process_ from src/xbt_sg_thread.h */
80
81 } s_smx_process_t;
82 /** @} */
83 /** @brief Agent datatype  
84     @ingroup m_datatypes_management 
85
86     An agent may be defined as a <em>code</em>, with some <em>private
87     data</em>, executing in a <em>location</em>.
88     \see m_process_management
89   @{ */
90 typedef struct s_smx_process *smx_process_t;
91 /** @} */
92
93 /** @brief Agent code
94     @ingroup m_datatypes_management 
95     The code of an agent is a m_process_code_t, i.e. a function with no arguments 
96     returning no value.
97     \see m_process_management
98   @{ */
99 typedef int(*smx_process_code_t)(int argc,char *argv[]) ;
100 /** @} */
101
102 SG_END_DECL()
103 #endif