Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent forward events from overtaking cancel events. #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ IF(NOT VALID_ARCH)
"Please set ARCH to be one of (i386 | bgl | bgp | x86_64 | ppc64)")
ENDIF(NOT VALID_ARCH)

# Prevent forward events from overtaking cancel events
OPTION(PRIORITIZE_CANCEL_EVENTS "Disable second forward event from overtaking the cancel event?" OFF)
IF(PRIORITIZE_CANCEL_EVENTS)
ADD_DEFINITIONS(-DPRIORITIZE_CANCEL_EVENTS=1)
ENDIF(PRIORITIZE_CANCEL_EVENTS)

# ROSS Core code
ADD_SUBDIRECTORY(core)

Expand Down
11 changes: 11 additions & 0 deletions core/network-mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,12 @@ send_begin(tw_pe *me)
if (!e)
break;

#if PRIORITIZE_CANCEL_EVENTS
if (e->state.cancel_asend) {
break;
}
#endif

if(e == me->abort_event)
tw_error(TW_LOC, "Sending abort event!");

Expand Down Expand Up @@ -628,7 +634,9 @@ send_finish(tw_pe *me, tw_event *e, char * buffer)
*/
e->state.cancel_asend = 0;
e->state.cancel_q = 1;
#if !PRIORITIZE_CANCEL_EVENTS
tw_eventq_push(&outq, e);
#endif
} else {
/* Event finished transmission and was not cancelled.
* Add to our sent event queue so we can retain the
Expand Down Expand Up @@ -735,6 +743,9 @@ tw_net_cancel(tw_event *e)
* this message is completed.
*/
e->state.cancel_asend = 1;
#if PRIORITIZE_CANCEL_EVENTS
tw_eventq_unshift(&outq, e);
#endif
break;

case TW_pe_sevent_q:
Expand Down