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

style: tryAddEvent to safeCall #3045

Merged
merged 5 commits into from
Nov 7, 2024
Merged

style: tryAddEvent to safeCall #3045

merged 5 commits into from
Nov 7, 2024

Conversation

mehah
Copy link
Contributor

@mehah mehah commented Nov 1, 2024

safeCall basically keeps calls safe when they are being executed asynchronously, that is, if the calls inside safeCall are being executed in a thread other than the dispatcher, they will simply be sent to that thread, thus avoiding concurrency.

What I just wrote is already being done with tryAddEvent, but it is not a very intuitive name, and it is visually polluted. In the safeCall method, besides being short, you can simply send 'this' as a parameter to the lambda, without having to fear that its execution will be done when the reference no longer exists, because inside safeCall, there is a reference check, if it has already been destroyed, it will simply not be executed.

Copy link

sonarqubecloud bot commented Nov 4, 2024

@dudantas dudantas merged commit 4ae6bdf into main Nov 7, 2024
35 checks passed
@dudantas dudantas deleted the safecall branch November 7, 2024 02:13
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.

4 participants