Skip to content

Update Is Canceled.vi so it executes regardless of error in.#699

Merged
jasonmreding merged 1 commit intomainfrom
users/jreding/AlwaysCheckCancelled
Mar 27, 2026
Merged

Update Is Canceled.vi so it executes regardless of error in.#699
jasonmreding merged 1 commit intomainfrom
users/jreding/AlwaysCheckCancelled

Conversation

@jasonmreding
Copy link
Copy Markdown
Collaborator

What does this Pull Request accomplish?

Is Cancelled.vi now always executes regardless of error in and merges the error chain afterwards to preserve any existing errors.

Why should this Pull Request be merged?

Measurements often use this API as part of loop shutdown/cleanup logic. If the call doesn't accurately reflect the cancellation status when there is an error, it is easy to write loops with race conditions that will never exit. This was observed in testing with the Game of Life example shown below.

image

If cancellation occurs in between the call to Is Cancelled.vi and Update Results.vi, then the Update Results.vi will generate an error because the RPC has been cancelled and the result can no longer be sent to the client. This error then gets shifted around through the loop, Is Cancelled.vi will always return false because of the error, and the loop never exits.

Rather than force callers to know they have to call Is Cancelled.vi with no error in these scenarios, it was decided it was harmless and less error prone to just always execute the core logic of the VI. The latest block diagram for the VI is shown below:

image

What testing has been done?

Basic hand testing. No "hangs" of the Game of Life example were observed after making this change.

@jasonmreding jasonmreding merged commit 5bf5b1b into main Mar 27, 2026
5 checks passed
@jasonmreding jasonmreding deleted the users/jreding/AlwaysCheckCancelled branch March 27, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants