Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
network actions should be suspendable too. In fact it seems to me that it is the...
[simgrid.git] / src / surf / workstation.c
index 19cdad3..4a5cb42 100644 (file)
@@ -127,24 +127,26 @@ static surf_action_t action_sleep(void *workstation, double duration)
 
 static void action_suspend(surf_action_t action)
 {
-  xbt_assert0(action->resource_type ==
-             ((surf_resource_t) surf_cpu_resource),
-             "Resource type mismatch");
-  surf_cpu_resource->extension_public->suspend(action);
+  if(action->resource_type==(surf_resource_t)surf_network_resource) 
+    surf_network_resource->extension_public->suspend(action);
+  else if(action->resource_type==(surf_resource_t)surf_cpu_resource) 
+    surf_cpu_resource->extension_public->suspend(action);
+  else DIE_IMPOSSIBLE;
 }
 
 static void action_resume(surf_action_t action)
 {
-  xbt_assert0(action->resource_type ==
-             ((surf_resource_t) surf_cpu_resource),
-             "Resource type mismatch");
-  surf_cpu_resource->extension_public->resume(action);
+  if(action->resource_type==(surf_resource_t)surf_network_resource)
+    surf_network_resource->extension_public->resume(action);
+  else if(action->resource_type==(surf_resource_t)surf_cpu_resource)
+    surf_cpu_resource->extension_public->resume(action);
+  else DIE_IMPOSSIBLE;
 }
 
 static int action_is_suspended(surf_action_t action)
 {
   if(action->resource_type==(surf_resource_t)surf_network_resource) 
-    return 0;
+    return surf_network_resource->extension_public->is_suspended(action);
   if(action->resource_type==(surf_resource_t)surf_cpu_resource) 
     return surf_cpu_resource->extension_public->is_suspended(action);
   DIE_IMPOSSIBLE;
@@ -241,14 +243,25 @@ static void surf_workstation_resource_init_internal(void)
   xbt_assert0(maxmin_system, "surf_init has to be called first!");
 }
 
-void surf_workstation_resource_init(const char *filename)
+/********************************************************************/
+/* The model used in MSG and presented at CCGrid03                  */
+/********************************************************************/
+/* @InProceedings{Casanova.CLM_03, */
+/*   author = {Henri Casanova and Arnaud Legrand and Loris Marchal}, */
+/*   title = {Scheduling Distributed Applications: the SimGrid Simulation Framework}, */
+/*   booktitle = {Proceedings of the third IEEE International Symposium on Cluster Computing and the Grid (CCGrid'03)}, */
+/*   publisher = {"IEEE Computer Society Press"}, */
+/*   month = {may}, */
+/*   year = {2003} */
+/* } */
+void surf_workstation_resource_init_CLM03(const char *filename)
 {
 /*   int i ; */
 /*   surf_resource_t resource =  NULL; */
 
   surf_workstation_resource_init_internal();
-  surf_cpu_resource_init(filename);
-  surf_network_resource_init(filename);
+  surf_cpu_resource_init_Cas01(filename);
+  surf_network_resource_init_CM02(filename);
   create_workstations();
   xbt_dynar_push(resource_list, &surf_workstation_resource);
 /*   xbt_dynar_foreach(resource_list, i, resource) { */