-
-/* Returns whether a task can start now on a workstation*/
-/*
- int __SD_workstation_can_start(SD_workstation_t workstation, SD_task_t task) {
- SD_CHECK_INIT_DONE();
- xbt_assert(workstation != NULL && task != NULL, "Invalid parameter");
-
- return !__SD_workstation_is_busy(workstation) &&
- (xbt_fifo_size(workstation->task_fifo) == 0) || xbt_fifo_get_first_item(workstation->task_fifo) == task);
- }
-*/
-
-/* Returns whether a workstation is busy. A workstation is busy is it is
- * in sequential mode and a task is running on it or the fifo is not empty.
- */
-int __SD_workstation_is_busy(SD_workstation_t workstation)
-{
- XBT_DEBUG
- ("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d",
- SD_workstation_get_name(workstation),
- (sg_host_sd(workstation)->access_mode ==
- SD_WORKSTATION_SHARED_ACCESS) ? "SHARED" : "FIFO",
- (sg_host_sd(workstation)->current_task ?
- SD_task_get_name(sg_host_sd(workstation)->current_task)
- : "none"),
- (sg_host_sd(workstation)->task_fifo ? xbt_fifo_size(sg_host_sd(workstation)->task_fifo) :
- 0));
-
- return sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS &&
- (sg_host_sd(workstation)->current_task != NULL
- || xbt_fifo_size(sg_host_sd(workstation)->task_fifo) > 0);
-}
-
-/* Destroys a workstation.
- */
-void __SD_workstation_destroy(void *workstation)
-{
-
- if (workstation==NULL)
- return;
- SD_workstation_priv_t w;
-
- /* workstation->surf_workstation is freed by surf_exit and workstation->data is freed by the user */
-
- w = (SD_workstation_priv_t) workstation;
-
- if (w->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) {
- xbt_fifo_free(w->task_fifo);
- }
- 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)
-{
- xbt_assert(sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS,
- "Access mode must be set to SD_WORKSTATION_SEQUENTIAL_ACCESS"
- " to use this function");
-
- return (sg_host_sd(workstation)->current_task);
-}
-