3 /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo.
4 All rights reserved. */
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. */
12 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_action, simix,
13 "Logging specific to SIMIX (action)");
15 /************************************* Actions *********************************/
17 smx_action_t SIMIX_communicate(smx_host_t sender,smx_host_t receiver, double size)
19 return xbt_new0(s_smx_action_t,1);
22 smx_action_t SIMIX_execute(smx_host_t host,double amount)
24 return xbt_new0(s_smx_action_t,1);
27 SIMIX_error_t SIMIX_action_cancel(smx_action_t action)
33 void SIMIX_action_set_priority(smx_action_t action, double priority)
38 SIMIX_error_t SIMIX_action_destroy(smx_action_t action)
43 void SIMIX_create_link(smx_action_t action, smx_cond_t cond)
48 SIMIX_error_t __SIMIX_wait_for_action(smx_process_t process, smx_action_t action)
50 e_surf_action_state_t state = SURF_ACTION_NOT_IN_THE_SYSTEM;
51 simdata_action_t simdata = action->simdata;
53 xbt_assert0(((process != NULL) && (action != NULL) && (action->simdata != NULL)), "Invalid parameters");
55 /* change context while the action is running */
58 state=surf_workstation_resource->common_public->action_get_state(simdata->surf_action);
59 } while (state==SURF_ACTION_RUNNING);
61 /* action finished, we can continue */
63 if(state == SURF_ACTION_DONE) {
64 if(surf_workstation_resource->common_public->action_free(simdata->surf_action))
65 simdata->surf_action = NULL;
66 SIMIX_RETURN(SIMIX_OK);
67 } else if(surf_workstation_resource->extension_public->
68 get_state(SIMIX_process_get_host(process)->simdata->host)
70 if(surf_workstation_resource->common_public->action_free(simdata->surf_action))
71 simdata->surf_action = NULL;
72 SIMIX_RETURN(SIMIX_HOST_FAILURE);
74 if(surf_workstation_resource->common_public->action_free(simdata->surf_action))
75 simdata->surf_action = NULL;
76 SIMIX_RETURN(SIMIX_ACTION_CANCELLED);