Skip to content

Simplify removeContinuationFromList loop logic #21458

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 4 additions & 8 deletions runtime/oti/ContinuationHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,22 +303,18 @@ class VM_ContinuationHelpers {
removeContinuationFromList(J9VMContinuation **list, J9VMContinuation *continuation)
{
bool foundInList = false;
J9VMContinuation *previous = NULL;
J9VMContinuation *current = *list;

while (NULL != current) {
if (continuation == current) {
foundInList = true;
if (NULL == previous) {
*list = current->nextWaitingContinuation;
} else {
previous->nextWaitingContinuation = current->nextWaitingContinuation;
}
/* Remove Continuation from the linked list. */
*list = current->nextWaitingContinuation;
current->nextWaitingContinuation = NULL;
break;
}
previous = current;
current = current->nextWaitingContinuation;
link = &current->nextWaitingContinuation;
current = *link;
Comment on lines +312 to +317
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't compile (link is not declared) and won't do the right thing (we don't always want to update *list).

}

return foundInList;
Expand Down