-
Notifications
You must be signed in to change notification settings - Fork 156
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
Comments
This is certainly good idea, but I need some help in the design. A lot of heavy calculation is done in the
Sending Maybe some solution would be to globally set particular thread id that should be cancelled ... Let's discuss. Best regards |
You have to add a CancellationToken in all methods, going all the down the
stack. It’s a big change… see this screenshot. Let me know how I can help.
Thanks,
Andy
…On Sat, Mar 19, 2022 at 6:17 PM Mariusz Gromada ***@***.***> wrote:
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:
- JAVA:
https://github.com/mariuszgromada/MathParser.org-mXparser/blob/master/CURRENT/java/src/org/mariuszgromada/math/mxparser/mathcollection/Calculus.java
- .NET:
https://github.com/mariuszgromada/MathParser.org-mXparser/blob/master/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/Calculus.cs
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
—
Reply to this email directly, view it on GitHub
<#206 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHHLIKKAM7TQ6TYHTFXJMALVAZHALANCNFSM4MLZRMAQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
In the next major release I will try to make it happen :-) |
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.
The text was updated successfully, but these errors were encountered: