-
- if (simdata->mutex) {
- /* process blocked on a mutex, only set suspend=1 */
- simdata->suspended = 1;
- }
- else if (simdata->cond){
- /* process blocked cond, suspend all actions */
-
- /* temporaries variables */
- smx_cond_t c;
- xbt_fifo_item_t i;
- smx_action_t act;
-
- simdata->suspended = 1;
- c = simdata->cond;
- xbt_fifo_foreach(c->actions,i,act, smx_action_t) {
- surf_workstation_resource->common_public->suspend(act->simdata->surf_action);
- }
- }
- else {
- simdata->suspended = 1;
- }
+
+ if (simdata->mutex) {
+ /* process blocked on a mutex, only set suspend=1 */
+ simdata->suspended = 1;
+ } else if (simdata->cond) {
+ /* process blocked cond, suspend all actions */
+
+ /* temporaries variables */
+ smx_cond_t c;
+ xbt_fifo_item_t i;
+ smx_action_t act;
+
+ simdata->suspended = 1;
+ c = simdata->cond;
+ xbt_fifo_foreach(c->actions, i, act, smx_action_t) {
+ surf_workstation_model->common_public->suspend(act->simdata->
+ surf_action);
+ }
+ } else {
+ simdata->suspended = 1;
+ }
+ } else {
+ /* process executing, I can create an action and suspend it */
+ smx_action_t dummy;
+ smx_cond_t cond;
+ char name[] = "dummy";
+ process->simdata->suspended = 1;
+
+ cond = SIMIX_cond_init();
+ dummy = SIMIX_action_execute(SIMIX_process_get_host(process), name, 0);
+ surf_workstation_model->common_public->suspend(dummy->simdata->surf_action);
+ SIMIX_register_action_to_condition(dummy, cond);
+ __SIMIX_cond_wait(cond);
+ //SIMIX_action_destroy(dummy);
+ //SIMIX_cond_destroy(cond);