xbt_fifo_item_t request_item;
xbt_fifo_item_t message_item;
+ e_surf_action_state_t state;
+
self = SIMIX_process_self();
// make sure root is done before own initialization
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
- if (!smpi_global->root_ready) {
+ while (!smpi_global->root_ready) {
SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
}
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
// wait for all nodes to signal initializatin complete
SIMIX_mutex_lock(smpi_global->start_stop_mutex);
smpi_global->ready_process_count++;
- if (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
- SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
- } else {
+ if (smpi_global->ready_process_count >= 3 * smpi_global->host_count) {
SIMIX_cond_broadcast(smpi_global->start_stop_cond);
}
+ while (smpi_global->ready_process_count < 3 * smpi_global->host_count) {
+ SIMIX_cond_wait(smpi_global->start_stop_cond, smpi_global->start_stop_mutex);
+ }
SIMIX_mutex_unlock(smpi_global->start_stop_mutex);
do {
NULL != message_item;
message_item = xbt_fifo_get_next_item(message_item)) {
message = xbt_fifo_get_item_content(message_item);
- if (request->comm == message->comm &&
- (MPI_ANY_SOURCE == request->src || request->src == message->src) &&
- (MPI_ANY_TAG == request->tag || request->tag == message->tag)) {
+ state = SIMIX_action_get_state(message->action);
+ if (
+ request->comm == message->comm &&
+ (MPI_ANY_SOURCE == request->src || request->src == message->src) &&
+ (MPI_ANY_TAG == request->tag || request->tag == message->tag) &&
+ (state != SURF_ACTION_READY && state != SURF_ACTION_RUNNING)
+ ) {
xbt_fifo_remove_item(request_queue, request_item);
xbt_fifo_remove_item(message_queue, message_item);
goto stopsearch;
SIMIX_process_suspend(self);
} else {
+ // FIXME: check action status for bad messages
+
SIMIX_mutex_lock(request->mutex);
memcpy(request->buf, message->buf, request->datatype->size * request->count);
request->src = message->src;