-
Notifications
You must be signed in to change notification settings - Fork 3.6k
=act Extract AtomicCancellable in Scheduler. #31915
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
base: main
Are you sure you want to change the base?
Conversation
octonato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
233dad1 to
0e66f16
Compare
| try { | ||
| runnable.run() | ||
| if (self.get != null) | ||
| if (get != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the other place it is
if (self.get() != null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is self => used there but not here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I need to access the AtomicReference there but not the outer AtomicLong, and here we can access it directly.
| runnable.run() | ||
| val driftNanos = clock() - getAndAdd(delay.toNanos) | ||
| if (self.get != null) | ||
| if (self.get() != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self refs to the AtomicReference.
It was a little refractory when reading the code