Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add a SD_workstation_get_current_task function
[simgrid.git] / src / simdag / sd_workstation.c
index 6918b41..d2a00e1 100644 (file)
@@ -1,3 +1,9 @@
+/* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
 #include "private.h"
 #include "simdag/simdag.h"
 #include "xbt/dict.h"
@@ -492,3 +498,18 @@ void __SD_workstation_destroy(void *workstation)
   }
   xbt_free(w);
 }
+
+/** 
+ * \brief Returns the kind of the task currently running on a workstation
+ * Only call this with sequential access mode set
+ * \param workstation a workstation */
+SD_task_t SD_workstation_get_current_task(SD_workstation_t workstation)
+{
+  SD_CHECK_INIT_DONE();
+  xbt_assert0(workstation != NULL, "Invalid parameter");
+  xbt_assert0(workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS, 
+             "Access mode must be set to SD_WORKSTATION_SEQUENTIAL_ACCESS"
+             " to use this function");
+  
+  return (workstation->current_task);
+}