We need to cancel ourselves before we're posted to the RunQueue and in order to
preserve Interval's behavior of not executing an interval that was canceled after it was posted to its runqueue but before it was executed we have to do some nested craziness. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5882 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -279,10 +279,19 @@ public class PresentsDObjectMgr
|
||||
// from interface RootDObjectManager
|
||||
public Interval newInterval (final Runnable action)
|
||||
{
|
||||
return new Interval(this) {
|
||||
return new Interval() {
|
||||
public void expired () {
|
||||
if (isRunning()) {
|
||||
action.run();
|
||||
postRunnable(new Runnable() {
|
||||
public void run () {
|
||||
// if we were canceled between the time that we posted this runnable
|
||||
// and the time the dobjmgr got around to executing us, we opt not to
|
||||
// actually execute our runnable because that's how Interval does it
|
||||
if (_task != null) {
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user