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

(C#) Ability to cancel a single thread with CancellationToken #206

Open
RufRef opened this issue Apr 19, 2020 · 3 comments
Open

(C#) Ability to cancel a single thread with CancellationToken #206

RufRef opened this issue Apr 19, 2020 · 3 comments

Comments

@RufRef
Copy link

RufRef commented Apr 19, 2020

mXparser.cancelCurrentCalculation() might be useful for simple use cases, but if you are running many calculations on multiple threads; it stops them all.

Please add a CancellationToken parameter to Expression.calculate() so that ONE calculation can be cancelled; not all of the currently-running ones.

Thanks.

@mariuszgromada
Copy link
Owner

mariuszgromada commented Mar 19, 2022

This is certainly good idea, but I need some help in the design. A lot of heavy calculation is done in the final class (java) or sealed class (.NET) using static methods. Take a look on the Calculus examples searching for if (mXparser.isCurrentCalculationCancelled()) return Double.NaN:

Sending CancellationToken to Expression.calculate() would require strong code refactoring ...

Maybe some solution would be to globally set particular thread id that should be cancelled ...

Let's discuss.

Best regards

@RufRef
Copy link
Author

RufRef commented Mar 24, 2022 via email

@mariuszgromada
Copy link
Owner

In the next major release I will try to make it happen :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants