Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
task->data (formerly callback) could not be set by end-users.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Dec 2004 00:55:07 +0000 (00:55 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Dec 2004 00:55:07 +0000 (00:55 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@697 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/surf/surf.h
src/surf/cpu.c
src/surf/network.c
src/surf/surf.c
src/surf/surf_private.h
src/surf/workstation.c

index 4a7ebcf..b54447c 100644 (file)
@@ -47,7 +47,7 @@ typedef struct surf_action {
   double start;                        /* start time  */
   double finish;               /* finish time : this is modified during the run
                                 * and fluctuates until the task is completed */
-  void *callback;              /* for your convenience */
+  void *data;                  /* for your convenience */
   surf_resource_t resource_type;
 } s_surf_action_t;
 
@@ -67,6 +67,8 @@ typedef struct surf_resource_public {
   void (*action_recycle) (surf_action_t action);
   void (*action_change_state) (surf_action_t action,
                               e_surf_action_state_t state);
+  void (*action_set_data) (surf_action_t action,
+                          void *data);
   const char *name;
 } s_surf_resource_public_t, *surf_resource_public_t;
 
index 970c20c..e9ecb06 100644 (file)
@@ -270,8 +270,6 @@ static surf_action_t execute(void *cpu, double size)
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = surf_get_clock();
   action->generic_action.finish = -1.0;
-/*   action->generic_action.callback = cpu; */
-  action->generic_action.callback = NULL;
   action->generic_action.resource_type =
       (surf_resource_t) surf_cpu_resource;
 
@@ -371,6 +369,7 @@ static void surf_cpu_resource_init_internal(void)
   surf_cpu_resource->common_public->action_recycle = action_recycle;
   surf_cpu_resource->common_public->action_change_state =
       action_change_state;
+  surf_cpu_resource->common_public->action_set_data = surf_action_set_data;
   surf_cpu_resource->common_public->name = "CPU";
 
   surf_cpu_resource->common_private->resource_used = resource_used;
index b88265c..5f2960d 100644 (file)
@@ -416,7 +416,6 @@ static surf_action_t communicate(void *src, void *dst, double size)
   action->generic_action.max_duration = NO_MAX_DURATION;
   action->generic_action.start = -1.0;
   action->generic_action.finish = -1.0;
-  action->generic_action.callback = NULL;
   action->generic_action.resource_type =
       (surf_resource_t) surf_network_resource;
 
@@ -493,6 +492,7 @@ static void surf_network_resource_init_internal(void)
   surf_network_resource->common_public->action_recycle = action_recycle;
   surf_network_resource->common_public->action_change_state =
       action_change_state;
+  surf_network_resource->common_public->action_set_data = surf_action_set_data;
   surf_network_resource->common_public->name = "network";
 
   surf_network_resource->common_private->resource_used = resource_used;
index 5308482..6daa250 100644 (file)
@@ -103,6 +103,12 @@ void surf_action_change_state(surf_action_t action,
     xbt_swag_insert(action, action->state_set);
 }
 
+void surf_action_set_data(surf_action_t action,
+                         void *data)
+{
+  action->data=data;
+}
+
 void surf_init(int *argc, char **argv)
 {
   xbt_init(argc, argv);
index ff76645..6452c47 100644 (file)
@@ -38,6 +38,8 @@ e_surf_action_state_t surf_action_get_state(surf_action_t action);
 void surf_action_free(surf_action_t * action);
 void surf_action_change_state(surf_action_t action,
                              e_surf_action_state_t state);
+void surf_action_set_data(surf_action_t action,
+                         void *data);
 
 extern lmm_system_t maxmin_system;
 extern tmgr_history_t history;
index 50a294f..c687495 100644 (file)
@@ -195,6 +195,7 @@ static void surf_workstation_resource_init_internal(void)
       action_recycle;
   surf_workstation_resource->common_public->action_change_state =
       action_change_state;
+  surf_workstation_resource->common_public->action_set_data = surf_action_set_data;
   surf_workstation_resource->common_public->name = "Workstation";
 
   surf_workstation_resource->common_private->resource_used = resource_used;