-
Notifications
You must be signed in to change notification settings - Fork 1
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
RepeatingTaskThread #36
Conversation
ea23027
to
ccad200
Compare
* | ||
* @return {@code false} if {@link #kill()} or {@link #blockingKill()} has been called. {@code true} otherwise. | ||
*/ | ||
public boolean isRunning() |
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.
This method is extremely similar to isAlive()
. Should it be kept?
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.
Would you use it anywhere?
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.
Nope, I can't think of a place where I'd use it
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.
isRunning()
and isRepeating
are not intuitive. I would just provide getCompleted
and getRemaining
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.
I can remove isRunning
, but I'll probably keep isRepeating
package private to use in tests. It is handy there
* remains interrupted. | ||
*/ | ||
// Uses ThreadTools.parkAtLeast, which will not throw InterruptedException, but | ||
// will return early when this thread is interrupted. |
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.
I think this is false, because parkAtLeast loops until the desired time has elapsed. It might just free spin if parkNanos is returning immediately due to the interrupt. We should probably fix that haha.
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.
I fixed this in #41
// clear interrupted status | ||
interrupted(); | ||
// clears interrupted status from | ||
if (interrupted() && executionState.getScheduled() == 0L) |
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.
I agree with this behavior. But what about clearing the interrupt status somewhere else, so it doesn't depend on whether the thread is throttled?
6e66dd0
to
aa83295
Compare
Co-authored-by: Duncan Calvert <dcalvert@ihmc.org>
609561c
to
77b5148
Compare
Replacement for
RestartableThread
andRestartableThrottledThread
!