-
- /* If I'm killing myself then stop otherwise schedule the process to kill
- * Two different behaviors, if I'm killing my self, remove from mutex and condition and stop. Otherwise, first we must schedule the process, wait its ending and after remove it from mutex and condition */
- if (process == SIMIX_process_self()) {
- /* Cleanup if we were waiting for something */
- if (process->mutex)
- xbt_swag_remove(process, process->mutex->sleeping);
-
- if (process->cond)
- xbt_swag_remove(process, process->cond->sleeping);
- if (process->waiting_action) {
- SIMIX_unregister_action_to_condition(process->waiting_action, process->cond);
- SIMIX_action_destroy(process->waiting_action);
- }
- SIMIX_context_stop(process->context);
- } else {
- DEBUG2("%p here! killing %p", simix_global->current_process, process);
- SIMIX_process_schedule(process);
- /* Cleanup if we were waiting for something */
- if (process->mutex)
- xbt_swag_remove(process, process->mutex->sleeping);
-
- if (process->cond) {
- xbt_swag_remove(process, process->cond->sleeping);
-
- if (process->waiting_action) {
- SIMIX_unregister_action_to_condition(process->waiting_action, process->cond);
- SIMIX_action_destroy(process->waiting_action);
- }
+ process->blocked = 0;
+ process->suspended = 0;
+ /* FIXME: set doexception to 0 also? */
+
+ if (process->waiting_action) {
+
+ switch (process->waiting_action->type) {
+
+ case SIMIX_ACTION_EXECUTE:
+ case SIMIX_ACTION_PARALLEL_EXECUTE:
+ SIMIX_host_execution_destroy(process->waiting_action);
+ break;
+
+ case SIMIX_ACTION_COMMUNICATE:
+ SIMIX_comm_destroy(process->waiting_action);
+ break;
+
+ case SIMIX_ACTION_SLEEP:
+ SIMIX_process_sleep_destroy(process->waiting_action);
+ break;
+
+ case SIMIX_ACTION_SYNCHRO:
+ SIMIX_synchro_stop_waiting(process, process->request);
+ SIMIX_synchro_destroy(process->waiting_action);
+ break;
+
+ case SIMIX_ACTION_IO:
+ THROW_UNIMPLEMENTED;
+ break;