-/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2007-2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
static smx_action_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout)
{
XBT_IN("(%p, %f)",smx_host,timeout);
- surf_model_t ws_model = surf_resource_model(smx_host, SURF_WKS_LEVEL);
smx_action_t action;
action = xbt_mallocator_get(simix_global->action_mallocator);
action->type = SIMIX_ACTION_SYNCHRO;
action->name = xbt_strdup("synchro");
action->synchro.sleep =
- ws_model->extension.workstation.sleep(smx_host, timeout);
+ surf_workstation_sleep(smx_host, timeout);
- ws_model->action_data_set(action->synchro.sleep, action);
+ surf_action_set_data(action->synchro.sleep, action);
XBT_OUT();
return action;
}
XBT_IN("(%p)",action);
XBT_DEBUG("Destroying synchro %p", action);
xbt_assert(action->type == SIMIX_ACTION_SYNCHRO);
-
- action->synchro.sleep->model_obj->action_unref(action->synchro.sleep);
+ surf_action_unref(action->synchro.sleep);
xbt_free(action->name);
xbt_mallocator_release(simix_global->action_mallocator, action);
XBT_OUT();
{
XBT_IN("(%p)",action);
xbt_assert(action->type == SIMIX_ACTION_SYNCHRO);
- surf_model_t ws_model = action->synchro.sleep->model_obj;
-
- if (ws_model->action_state_get(action->synchro.sleep) == SURF_ACTION_FAILED)
+ if (surf_action_get_state(action->synchro.sleep) == SURF_ACTION_FAILED)
action->state = SIMIX_FAILED;
- else if(ws_model->action_state_get(action->synchro.sleep) == SURF_ACTION_DONE)
+ else if(surf_action_get_state(action->synchro.sleep) == SURF_ACTION_DONE)
action->state = SIMIX_SRC_TIMEOUT;
SIMIX_synchro_finish(action);
XBT_DEBUG("Sem release semaphore %p", sem);
if ((proc = xbt_swag_extract(sem->sleeping))) {
- proc = xbt_swag_extract(sem->sleeping);
SIMIX_synchro_destroy(proc->waiting_action);
proc->waiting_action = NULL;
SIMIX_simcall_answer(&proc->simcall);
}
/** @brief Returns true if acquiring this semaphore would block */
-XBT_INLINE int SIMIX_sem_would_block(smx_sem_t sem)
+int SIMIX_sem_would_block(smx_sem_t sem)
{
XBT_IN("(%p)",sem);
XBT_OUT();